Guys, you need to be quick. ;-) First: My daughter had exactly the same issue (spinning wheel after entering the correct iCloud password). I couldn't figure out what was wrong, as the password she typed in was definitely the right one since login at www.icloud.com worked fine, as well es accessing e-mail inbox from witin Mail.app.
I don't remember how but I got the strong feeling that Photostream was causing the issue.
So, first of all I stopped the process Photostream (via activity monitor) and after that opened system preferences again. Now it's time to draw faster than your own shadow...
Watch all the entries in iCloud setting are being active for about one second before getting deactivated? Practice to quickly hit the check of "Photostream".
Switch back to the overview of system preference and click on "iCloud" again. QUICK - hit the check! 🙂 Did it? We we took away the check and the problem is gone!
If someone knows how to switch off this setting via terminal, please share it with us. Should be easier that way. But less fun. 😎