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.

Bug Unable to validate token error 401 when using SignInWithOculusAsync()

Discussion in 'Authentication' started by MyMinia, Dec 20, 2022.

  1. MyMinia

    MyMinia

    Joined:
    Apr 15, 2021
    Posts:
    4
    Hello, I am trying to use the new Oculus sign in capabilities of the Authentication package by using the example script provided for Oculus SignIn, however I get the next error when I try to use : AuthenticationService.Instance.SignInWithOculusAsync(oculusNonce, userId);

    Project Information :
    Unity 2021.3.15f1
    Authentication 2.3.1

    [Authentication]: Request failed: 401, {"title":"PERMISSION_DENIED","detail":"unable to validate token","details":[],"status":401}
    UnityEngine.Logger:LogError (string,object)
    Unity.Services.Authentication.Logger:LogError (object) (at Library/PackageCache/com.unity.services.authentication@2.3.1/Runtime/Utilities/Logger.cs:18)
    Unity.Services.Authentication.AuthenticationServiceInternal:BuildServerException (Unity.Services.Authentication.WebRequestException) (at Library/PackageCache/com.unity.services.authentication@2.3.1/Runtime/AuthenticationServiceInternal.cs:796)
    Unity.Services.Authentication.AuthenticationServiceInternal/<HandleSignInRequestAsync>d__108:MoveNext () (at Library/PackageCache/com.unity.services.authentication@2.3.1/Runtime/AuthenticationServiceInternal.cs:526)
    System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<Unity.Services.Authentication.SignInResponse>:SetException (System.Exception)
    Unity.Services.Authentication.WebRequest/<SendAsync>d__15`1<Unity.Services.Authentication.SignInResponse>:MoveNext () (at Library/PackageCache/com.unity.services.authentication@2.3.1/Runtime/Network/WebRequest.cs:63)
    System.Threading.Tasks.TaskCompletionSource`1<string>:SetException (System.Exception)
    Unity.Services.Authentication.WebRequest:RequestCompleted (System.Threading.Tasks.TaskCompletionSource`1<string>,long,bool,bool,string,string,System.Collections.Generic.IDictionary`2<string, string>) (at Library/PackageCache/com.unity.services.authentication@2.3.1/Runtime/Network/WebRequest.cs:193)
    Unity.Services.Authentication.WebRequest/<>c__DisplayClass16_0:<SendAttemptAsync>b__0 (UnityEngine.AsyncOperation) (at Library/PackageCache/com.unity.services.authentication@2.3.1/Runtime/Network/WebRequest.cs:76)
    UnityEngine.AsyncOperation:InvokeCompletionEvent ()

    Why does this error happens and how to solve it ?
     
  2. TijsVdV

    TijsVdV

    Joined:
    Mar 7, 2017
    Posts:
    32
    Experiencing the same issue!
     
  3. mahdik_unity

    mahdik_unity

    Unity Technologies

    Joined:
    Sep 16, 2021
    Posts:
    15
    Hello, thank you for your message,

    please verify these information:
    - Ensure your app id and app secret are correct
    - Ensure your app passed the data use checkup required by Oculus to be able to use their Authentication service
    - Ensure your test user passed the entitlement check! more info: Entitlement Check for Meta Store Apps: Unity | Oculus Developers
     
  4. MyMinia

    MyMinia

    Joined:
    Apr 15, 2021
    Posts:
    4
    I resolved the issue by granting authorization of the AppID in the Oculus Dashboard Data Use Check Up
     
    chengg_unity likes this.
  5. TijsVdV

    TijsVdV

    Joined:
    Mar 7, 2017
    Posts:
    32
    I still having trouble getting this to work. I still ge tRequest failed: 401, {"title":"PERMISSION_DENIED","detail":"unable to validate token","details":[],"status":401}

    I verified:
    - app id and secret are correct
    - Data use checkup is done
    - I pass the entitlments check with my developer account

    And still when i use the SignInWithOculusAsync it refuses me. Getting desperate here :(

    Edit: Just noticed when i set my details in the editor i get the same error
     
  6. TijsVdV

    TijsVdV

    Joined:
    Mar 7, 2017
    Posts:
    32
    I checked the Data use Check but don't see a part that says to approve the app id?
     
  7. MyMinia

    MyMinia

    Joined:
    Apr 15, 2021
    Posts:
    4
  8. TijsVdV

    TijsVdV

    Joined:
    Mar 7, 2017
    Posts:
    32
    I have that one approved. So that does not seem to be the problem.
     
  9. mahdik_unity

    mahdik_unity

    Unity Technologies

    Joined:
    Sep 16, 2021
    Posts:
    15
    hello @TijsVdV,

    please send me a direct message with your project id so that I can assist you further. Thank you
     
  10. TijsVdV

    TijsVdV

    Joined:
    Mar 7, 2017
    Posts:
    32
    I found the issue btw, there was an error with the OculusId we where passing to to login function. All solved now!
     
    mahdik_unity likes this.