OSX 10.9.5, had updated the PW from another machine, and one machine kept continually cycling the ICloud Preferences "enter password - send code - Now type in your password with code - no field to type it in - enter password again with code as instructed , it treats it as a new login says Invalid Password and takes you to the start of the loop & sends a new code.
Other machines had provided a field for entry of the code. this machine/OSX combination did not. ICloud preferences gives no option other than cycling through the loop again.
Thank you to iiviixi for the solution. Since the iCloud preference gets in a loop, generating part of the process outside the preference breaks the loop.
LACAllen, it is not helpful to keep repeating 'just do what I said' for four pages when you are not in possession of the same set of conditions and facts as the askers (and refuse to believe them when they say theirs is different and your method did not work) Yes, the format of typing the password you provided is accurate. No you cannot do it from where the problem occurred. No there is no other dialog box (I looked, many times) Yes, it is completely counter-intuitive that you have to spit off to another application to generate a new code instead of following the instruction in the current application. No my OSX is not corrupt and does not need to be installed.
The point is LAC and others who belittled the people having problems, what worked for you does not necessarily work for others who have different conditions.