Game Center authentication error though .authenticated property = true

I have an turn-based game using GameKit in iOS. Generally, my authentication with Game Center works. My game works and I can for periods of time send moves back and forth. However, relatively frequently but not constantly, when I try to perform an action (e.g., finding a new match) over Game Center it fails with the error:


Error Domain=GKErrorDomain Code=6 "The requested operation could not be completed because local player has not been authenticated." UserInfo={NSLocalizedDescription=The requested operation could not be completed because local player has not been authenticated.}


Yet, the GKLocalPlayer.localPlayer().authenticated = true, both immediately before getting the error and after. After getting this error, the authentication viewController does not get presented and GameKit methods that rely on authentication cease to function (they don't come back to life ). Then, if I send the app to the background and then bring it back to the foreground, the error does not return when I retry the action (without requiring new login and password entry).

According to this similar observation:


GKLocalPlayer authentication not working, but isAuthenticated returns YES (Game Center sandbox)

http://stackoverflow.com/questions/23541764/gklocalplayer-authentication-not-working-but-isauthenticated-returns-yes-game


"1.Game Center fails to complete authentication if your device has incorrect dates. So, go ahead and check the current date.

You might have done this. I trust you - iOS Simulator >> Reset Content and Settings"

I am getting this problem on the device, not the simulator, ruling out #2. Could someone help me with #1? I may be naive here, but my iPhone and iPad have the right time and date. Is there something or somewhere else I should be checking and setting?

Then, if this is not the issue, what else could be the problem? I am running iOS9.

Replies

hi all, any solution here?


actually I am with the same problem with one user testing the app in my device (not simulator)... it is working fine with other users...


I always get the following error:

UserInfo={GKServerStatusCode=5000, NSLocalizedDescription=The requested operation could not be completed because local player has not been authenticated., NSUnderlyingError=0x170452ed0 {Error Domain=GKServerErrorDomain Code=5000 "status = 5000, UNAUTHORIZED REQUEST (token validation failed)" UserInfo={GKServerStatusCode=5000, NSLocalizedFailureReason=status = 5000, UNAUTHORIZED REQUEST (token validation failed)}}}


By the way, that account user in the device is the same for iCloud, iTunes/App Store and Game Center.

Hello,


I had same error. I tried changing the apple ID of the game center. Then the problem was solved.


FYI.

I have the same problems. Getting lots of support issues from users that cannot play multiplayer because they get this error message.


I've told them to sign in with a different Game Center account, and that works, but it's no good solution at all.


Does anyone have a better solution?

must switch on game center in your ios device (settings->gamecenter)

In Settings in my device I signed out of Game Center and back in and it works now. I'm glad it's working, but hope my users won't have to do this too...

I have this error on my Mac Catalyst game (debug mode).

A very old thread, but I've had a similar issue just now. The problem seems to be that I had my sandbox testing account signed in to the device. After signing it out, and signing back in to a Game Center account, the issue resolved itself.

Sharing for anyone who may have googled the error codes.

_authenticateUsingAlert:Failed to authenticate player with existing credentials.Error: Error Domain=GKErrorDomain Code=6