Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Resolved Permission denied facebook sdk link with UGS.

Discussion in 'Authentication' started by pur3bl00d, Jul 10, 2022.

  1. pur3bl00d

    pur3bl00d

    Joined:
    Jan 21, 2019
    Posts:
    8
    After getting Facebook Access token from Facebook SDK, while linking the facebook it create errors.
    Code:
    Code (CSharp):
    1.  
    2. public async void linkFacebookUsingToken2(string accessToken) {
    3.         try {
    4.             await AuthenticationService.Instance.LinkWithFacebookAsync(accessToken);
    5.         }
    6.         catch (AuthenticationException ex) {
    7.             Debug.LogError(ex.ToString());
    8.         }
    9.         catch (RequestFailedException ex) {
    10.             Debug.LogError(ex.ToString());
    11.         }
    12.         catch (System.Exception ex) {
    13.             Debug.LogError(ex.ToString());
    14.         }
    15.     }
    16.  

    Error:
    1.
    [Authentication]: Request failed: 401, {"title":"PERMISSION_DENIED","detail":"unable to validate token","details":[],"status":401}
    0x00007ff79bb010cd (Unity) StackWalker::GetCurrentCallstack
    0x00007ff79bb07da9 (Unity) StackWalker::ShowCallstack
    0x00007ff79ca74e73 (Unity) GetStacktrace
    0x00007ff79d10a1cd (Unity) DebugStringToFile
    0x00007ff79ac6d372 (Unity) DebugLogHandler_CUSTOM_Internal_Log ...........

    2.
    Unity.Services.Authentication.AuthenticationException: unable to validate token ---> Unity.Services.Authentication.WebRequestException: {"title":"PERMISSION_DENIED","detail":"unable to validate token","details":[],"status":401}
    at Unity.Services.Authentication.WebRequest.SendAsync[T] () [0x00025] in E:\Game\Library\PackageCache\com.unity.services.authentication@2.0.0\Runtime\Network\WebRequest.cs:44
    at Unity.Services.Authentication.AuthenticationServiceInternal.LinkWithExternalTokenAsync (System.String idProvider, Unity.Services.Authentication.LinkWithExternalTokenRequest request) [0x0006e] in E:\Game\Library\PackageCache\com.unity.services.authentication@2.0.0\Runtime\AuthenticationServiceInternal.cs:352
    --- End of inner exception stack trace ---
    at Unity.Services.Authentication.AuthenticationServiceInternal.LinkWithExternalTokenAsync (System.String idProvider, Unity.Services.Authentication.LinkWithExternalTokenRequest request) [0x0013a] in E:\Game\Library\PackageCache\com.unity.services.authentication@2.0.0\Runtime\AuthenticationServiceInternal.cs:357
    at UnityGamingServiceManager.linkFacebookUsingToken (System.String accessToken) [0x0002f] in E:\Game\Assets\Scripts\UnityGamingService\UnityGamingServiceManager.cs:71 ..................
     
  2. pur3bl00d

    pur3bl00d

    Joined:
    Jan 21, 2019
    Posts:
    8
    This is so frustrating, working on this auth system for like 6 days still not working same error all the time.

    I changed my app type to "Consumer" in Facebook, and still does not work. Why there is no sample project for Auth for unity gaming service?

    Signing in also not working.

    Code (CSharp):
    1. await AuthenticationService.Instance.SignInWithFacebookAsync(accessToken);
    It throws same error unable to validate token. How does UGS validate token for facebook.
     
  3. Julian-Unity3D

    Julian-Unity3D

    Unity Technologies

    Joined:
    Apr 28, 2022
    Posts:
    191
  4. pur3bl00d

    pur3bl00d

    Joined:
    Jan 21, 2019
    Posts:
    8
    Currently I am using unity 2021.3.5f1 and Facebook SDK 11 (coz other are not working for me). All things are working fine like facebook auth, it signed in and gives access token. After supplying access token to SigninWithFacebookAsync it throws error ([Authentication]: Request failed: 401, {"title":"PERMISSION_DENIED","detail":"unable to validate token","details":[],"status":401}).
     
  5. pur3bl00d

    pur3bl00d

    Joined:
    Jan 21, 2019
    Posts:
    8
    I completely started from scratch now it's working it's very very weird. New Facebook account and added New App as "Consumer Type" (this one is very important).

    @Julian-Unity3D Thanks for replying cheers.
     
  6. Julian-Unity3D

    Julian-Unity3D

    Unity Technologies

    Joined:
    Apr 28, 2022
    Posts:
    191
    Hi @pur3bl00d

    I'm glad you've got it working now.

    All the best
     
  7. psabbir103

    psabbir103

    Joined:
    Jan 26, 2022
    Posts:
    1
    I have an error with facebook authentication that permissions denied 401
     
  8. MiTschMR

    MiTschMR

    Joined:
    Aug 28, 2018
    Posts:
    463
    Please open a new thread and provide some more information.