Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Anonymous Sign not working! Not generating Session Token!

Discussion in 'Multiplayer' started by Raphn, Aug 6, 2022.

  1. Raphn


    Nov 26, 2019
    Hi, everyone!

    Trying to build my first multiplayer using NetCode and all that new good stuff. But, every time I have the same error when trying to authenticate anonymously. Printing "AnalyticsSessionInfo.identityToken" displays an empty string!

    [Authentication]: Token has expired. [...]
    Unity.Services.Authentication.JwtDecoder:Decode<Unity.Services.Authentication.AccessToken> (string,Unity.Services.Authentication.WellKnownKey[]) (at Library/PackageCache/
    Unity.Services.Authentication.AuthenticationServiceInternal:CompleteSignIn ...
    RequestFailedException: Failed to decode and verify access token.
    Unity.Services.Authentication.AuthenticationServiceInternal.CompleteSignIn (Unity.Services.Authentication.SignInResponse response, System.Boolean enableRefresh) (at Library/PackageCache/

    Code (CSharp):
    1. private async Task Authenticate()
    2.     {
    3.         Debug.Log($"Starting authentication...");
    4.         await UnityServices.InitializeAsync();
    6.         Debug.Log($"Signing In Anonymously Async...");
    7.         await AuthenticationService.Instance.SignInAnonymouslyAsync();
    8.     }
  2. ItsNoxL


    Dec 13, 2020
    I know this post is a bit old, but I'm running into a similar issue. When I'm trying to authenticate on my machine, everything works as intended. But when I send a build of the game to my friend, he gets the exact same error

    [Authentication]: Token has expired.
    RequestFailedException: Failed to decode and verify access token.

    We are pretty desperate at this point and we even tried installing unity on his pc and writing a short authentication script there. It still didn't work for him. Has anyone found a way to fix it?