Search Unity

Bug Unity [Authentication]: Token has expired.

Discussion in 'Authentication' started by ChihiroOhsato, Jul 21, 2022.

  1. ChihiroOhsato

    ChihiroOhsato

    Joined:
    Mar 28, 2022
    Posts:
    1
    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)
     
    Dr_Shtenzel likes this.
  2. HerrPascal

    HerrPascal

    Joined:
    Apr 29, 2020
    Posts:
    7
    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?
     
  3. hippogames

    hippogames

    Joined:
    Feb 5, 2015
    Posts:
    234
    The same random error in my app.
     
  4. Dknighter2

    Dknighter2

    Joined:
    Aug 17, 2014
    Posts:
    44
    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.
     
  5. ItsNoxL

    ItsNoxL

    Joined:
    Dec 13, 2020
    Posts:
    4
    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)
     
    Last edited: Dec 23, 2022
  6. unity_D4A6C01F3EBB83613B4D

    unity_D4A6C01F3EBB83613B4D

    Joined:
    Oct 19, 2022
    Posts:
    13
    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
     
    Last edited: Jan 13, 2023
  7. Dknighter2

    Dknighter2

    Joined:
    Aug 17, 2014
    Posts:
    44
    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.
     
  8. hippogames

    hippogames

    Joined:
    Feb 5, 2015
    Posts:
    234
    This makes sense.
     
  9. ItsNoxL

    ItsNoxL

    Joined:
    Dec 13, 2020
    Posts:
    4
    Thank you! this fixed the problem, I would never have thought of this.
     
  10. Menion-Leah

    Menion-Leah

    Joined:
    Nov 5, 2014
    Posts:
    189
    Hi @Dknighter2 - we're seeing this on mobile as well: we don't expect users to be tweaking with their clock, there.
     
  11. erickb_unity

    erickb_unity

    Unity Technologies

    Joined:
    Sep 1, 2021
    Posts:
    92
    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.
     
    hippogames likes this.
  12. Menion-Leah

    Menion-Leah

    Joined:
    Nov 5, 2014
    Posts:
    189
    Good to hear that!
    Thanks for the quick answer