Can't login in Mac App Store or iCloud - login loading forever After updating to latest developer release for OS X El Capitan, I can't login in Mac App Store or OS X iCloud settings. If I try incorrect password, a message is shown that the password is not correct. When I try my real password, the loading icon just spins forever. 

I already tried to remove Network settings plist file and some other things found on forums. System log file shows a lot of these few messages, especially when doing something with iCloud login. 

SOSAccountThisDeviceCanSyncWithCircle sync with device failure: Error Domain=com.apple.security.sos.error Code=1035 "Account identity not set"  


and 

01/10/15 00:11:52,599 storeaccountd[591]: XPC error for connection com.apple.backupd.sandbox.xpc: Connection invalid  


and

01/10/15 00:11:52,931 sandboxd[226]: ([591]) storeaccountd(591) deny mach-lookup com.apple.backupd.sandbox.xpc


Unfortunately I do not have backup of my previous installation. Also I can't update to latest El Capitan version, because App Store login is not working.
NOTE: This solution is primarily meant for users of physical Apple devices, such as MacBooks, iMacs, Mac Pros, etc. While I will mention a link to a solution for virtual machine users as well, that is not the primary objective of this post. As such, that will not be posted here, for succinctness.

Also, while NVRAM (non-volatile RAM) does save certain settings and parameters for long-term, iCloud settings don't appear to be among the settings saved in NVRAM.

The solution will sound simple - but it's not. The full-out solution is a three-step process, which will force OS X to do the following: 


Wipe the existing, problematic settings file(s), and force OS X to reproduce valid ones in there place. 
(Re)Start the iCloud service and/or its required related Daemons. 
Validate/rewrite (hardware) machine details if required.


We’ll start by deleting the following file (admin permission required):
/Library/Preferences/com.apple.apsd.plist

We’ll then ensure that the proper LaunchDaemons are running - in this case, Push Notifications. iCloud needs this running to operate. Enter the following into Terminal:

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.apsd.plist

Finally, please check to make sure that your OS X device has a (valid) Serial Number. Whether it’s real or virtual machine, the Serial must be less than 12 chars - otherwise, iCloud -based services like FaceTime and iMessage won’t be able to sign in (or will ‘hang-up’ at sign in attempt). Check this in your Mac’s ‘About’ section. If you have either a NULL or invalid Serial Number, please do one of the following:


Either use your Apple Care/Warranty to contact Apple. Have them set your hardware Serial Number, seeing that they were supposed to do this when they were done servicing your machine. 


OR


Use the following application to change this (if you can't go to Apple for any reason, and aren't worried about voiding the device's warranty). Please do NOT use this tool if you have Apple Care or would like to preserve your Apple Warranty:


Blank Board Serializer -
Downloadable from here:

http://rogersm.net/icloud-problems-mountain-lion-serial-number



Now, for those of you using a virtual machine, please go here to complete the third step (Serial Number reset). You'll need to generate a valid, new Serial Number that is NOT currently in-use:

http://www.insanelymac.com/forum/topic/292170-how-to-spoof-real-mac-in-vmware/



That should fix any issues with iCloud sign in and use of its related services for El Capitan. Works for most physical Mac OS X devices and VMware Workstation installations.