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

Authentication Error with Leaderboards

Discussion in 'Android' started by FunInfused, Jan 21, 2022.

  1. FunInfused

    FunInfused

    Joined:
    Jun 16, 2021
    Posts:
    16
    I am really struggling getting Android leaderboards to work with my Android port of my game... hoping for some guidance here. Let me know if you need me to share anything else...

    I'm using the "Google Play Games plugin for Unity".. Unclear of that's the easiest thing but its what I started with. Open to other suggestions if there is something better.

    I've gone thru a few tutorials / videos and I thought I had it setup as they described, but I continue to be unable to authenticate my user when deployed to a device (and unclear if there is any other way to test this). In the C# code, "Social.Active.localUser.authenticated" is always false in my test.

    I know this is very vague but any tips of what to check, how to test better, better tutorial ideas, etc?
     
  2. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,832
    Authenticated false can be for many reasons. Before that did you finish the required setup?
    I'm sharing docs from our plugin which should be valid for GPGS too.
    Why Google Play Services Authentication fails?
    Configuration/Setup

    If you have already done the setup right and using the right tester account, share the complete logcat log to have a look.
     
  3. FunInfused

    FunInfused

    Joined:
    Jun 16, 2021
    Posts:
    16
    I've been going thru things and reviewing things and where I'm stuff at right now is that in Google Cloud, I've added an "OAuth 2.0 Client ID" but in the Developer Console Authorization section, it is saying I have no OAuth Clients available. I think that might be why this isn't working further downstream but I'm at a loss why I can't see my OAuth Client in Developer Console. I added it originally several weeks ago, rechecked settings last night and have been hitting Refresh OAuth Clients like a madman hoping it would show up.
     
  4. FunInfused

    FunInfused

    Joined:
    Jun 16, 2021
    Posts:
    16
    OK, I figured that out... I'd previously attempted to set one of these up and apparently selecting OAuth client in one credential means its removed from the pool for others. So I deleted the first one I was messing around with.

    Waiting for a Unity Cloud Build to finish to see if all my changes will resolve this. #CrossingFingers
     
    Voxel-Busters likes this.
  5. FunInfused

    FunInfused

    Joined:
    Jun 16, 2021
    Posts:
    16
    So I'm calling this code below and it doesn't return success or fail, it just continues to the next line.

    Later when I check if the user is authenticated (Social.localUser.authenticated) it returns false but I think that's a product of the first thing not working? Any ideas?

    Code (CSharp):
    1.             PlayGamesPlatform.Instance.Authenticate(interactivity, (code) =>
    2.             {
    3.                 if (code == SignInStatus.Success)
    4.                 {
    5.                     results.Succes = true;
    6.  
    7.                     Status = "Authenticated. Hello, " + Social.localUser.userName + " (" +
    8.                              Social.localUser.id + ")";
    9.                 }
    10.                 else
    11.                 {
    12.                     results.Succes = false;
    13.                     Status = "*** Failed to authenticate with " + code;
    14.                 }
    15.             });