Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

Bug Unable to Validate Token For Unity Player Accounts

Discussion in 'Authentication' started by PowerCore2000, Jun 22, 2023.

  1. PowerCore2000

    PowerCore2000

    Joined:
    Aug 7, 2013
    Posts:
    16
    I tried to run LinkWithUnityAsync() with my Anonymous AccessToken and ever time i try to link I get a 401 back with the following error:

    WebRequestException: {"title":"PERMISSION_DENIED","detail":"unable to validate token","details":[],"status":401}
     
  2. MiTschMR

    MiTschMR

    Joined:
    Aug 28, 2018
    Posts:
    529
    Where do you get the access token from? You need to get it from
    PlayerAccountsService.Instance.AccessToken
    . Are you maybe using the Session Token?
     
  3. benjaminp_unity

    benjaminp_unity

    Unity Technologies

    Joined:
    May 13, 2021
    Posts:
    2
    Hello,

    As MiTschMR suggested, the input for LinkWithUnityAsync needs to be the PlayerAccountsService.Instance.AccessToken value. I was able to track down the cause of the error and I suspect that the access token provided was from the AuthenticationService instance instead of the PlayerAccountsService instance. Hope this helps!
     
  4. PowerCore2000

    PowerCore2000

    Joined:
    Aug 7, 2013
    Posts:
    16
    Ah thank you so much. I didn't have the PlayerAccountsService preview package installed, and was using AuthenticationService instead.
     
    MiTschMR and chengg_unity like this.