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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

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:
    390
    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.