Many thanks for your responses.
Before making my original post, I checked to see if I could replicate the problem. I tried twice with a newly installed version of Raspbian that successfully booted to the desktop. Both times, I got the "Failed to authenticate" dialogue window after installing the script.
I put this down to more than coincidence, hence I made my post.
I have never seen this dialogue window when booting the the Raspbian desktop before. The dialogue window appears before any keyboard input is made, and it shouldn't be there in the first place. I would be very surprised if this was a keyboard problem.
Maybe it is coincidence, and I will try with an alternative SD card in case the problem lies there, for some reason (although it appears to work OK with a freshly installed version of Raspbian).
I will post back here if I discover something new, in case it helps someone else in the future.