Unity [Authentication]: Token has expired.

Environment

  • Unity2021.3.6f1
  • Android version Q (10)

I am trying to do an anonymous login using “com.unity.services.authentication”: “2.1.1” in Unity
I tried to write and build the code for anonymous login based on the documentation, and it succeeded in logging in on IOS, but failed in logging in on android.

I asked someone else to try it on their Android, and it seemed to occur on some devices even with Android version 12 (some devices did not have it).
Terminals with this problem keep giving the same error and cannot log in, while terminals without this problem are able to log in.

I was debugging to solve this problem and found this error together
Hope this helps to resolve the issue.

Error Unity RequestFailedException: Failed to decode and verify access token.
ErrorCode:0 (I let this line output itself.)
Error ResolverController No valid NAT64 prefix (133, <unspecified>/0)
1 Like

I have kinda the same issue on iOS. I got the iOS idtoken of the user but if I try to feed it into the ’
SignInWithAppleAsync’ method i get the exact same error. Were you ever able to fix the issue?

The same random error in my app.

We’re also getting this with Phasmophobia on PC. We don’t have many players with the issue however for people with it a VPN does not help.

I’m also running into this issue. The weird thing is that it’s completely fine on my machine, but when I send a build of the game to my friend, he gets an “Authentication token expired” error even though we’re both on the same version of windows 10. I have no idea how to fix it (maybe it’s a bug and we just need to wait until it gets fixed)

Got the same problem now. It works weff for the whole team excepts for 1 person.

Edit:
Make sure to “sync” the time in windows. the problem was time being 20s into the future

Hey, we’ve got this figured out now. Unity check the system clock on the players PC to see if it is within 1 hour of when the steam auth token was given. So if the players PC is set to the wrong time then it will give token expired. The only fix is to make them set their PC date to automatic.

This makes sense.

1 Like

Thank you! this fixed the problem, I would never have thought of this.

Hi @Dknighter21 - we’re seeing this on mobile as well: we don’t expect users to be tweaking with their clock, there.

Hello
We have removed clock validation on the client in version 2.5.0 of the Authentication package.
You can update to avoid this issue.

1 Like

Good to hear that!
Thanks for the quick answer