In my case, logging into my profile on icloud.com helped me. Just log in there to reset the tokens. Also check that in Preferences → Apple ID → Password & Security you have two-factor enabled.
After that, the login to the account in XCode was successful.