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

Google Play Games Authentication fails

Discussion in 'Android' started by garv3, Oct 27, 2016.

  1. garv3

    garv3

    Joined:
    Dec 30, 2012
    Posts:
    32
    Hey there!

    We have an issue using the Google Play Games Service for achievements in our game. The strange thing about this is that it worked before and suddenly stopped working some days ago and we are not sure, what could be the reason for this. We don't think that we changed anything that can affect this feature and this is really strange.
    The Service seems to be configured correctly on the Google Play Developer Console and everything is set up in the Unity project. The achievement XML in the Google Play settings is correct and the androidmanifest.xml contains the correct app id.
    What we do is very simple. We activate the platform:
    Code (CSharp):
    1. PlayGamesPlatform.DebugLogEnabled = true;
    2. PlayGamesPlatform.Activate();
    Then we check if the user is already authenticated and if not, we try to authenticate:
    Code (CSharp):
    1. if (!Social.localUser.authenticated)
    2. {
    3.      Debug.Log("\t not authenticated. Authenticating...");
    4.      Social.localUser.Authenticate((bool success) =>
    5.      {
    6.          if (success)
    7.          {
    8.               Debug.Log("SOCIAL: Successfull authenticated as: " + name);
    9.          }
    10.          else
    11.          {
    12.              Popup.OkDialogue("Connection failed", "name: " + Social.localUser.userName + ", state: " + Social.localUser.state + ", authenticated: " + Social.localUser.authenticated + ", id: " + Social.localUser.id);
    13.              Debug.Log("SOCIAL: Authentication failed!");
    14.          }
    15.      });
    16. }
    17. else
    18. {
    19.      Debug.Log("\t already authenticated as: " + Social.localUser.userName);
    20. }
    When we run it on Android, the user cannot be authenticated (success is false).
    Social.localUser.userName is empty.
    Social.localUser.state is "ONLINE".
    Social.localUser.authenticated is false.
    Social.localUser.id is empty.
    Of course the user has been added to the list of testers. When the app is launched, the player is asked to pick an account to use for the game - which is strange since there is only one account logged in to Google Play Games on the device and this did not happen before - and then the welcome message "Welcome back player_xy" is displayed. But this is misleading, since the authentication obviously fails.

    Any ideas? We are really stuck on this.

    Thank you in advance!
    garv3
     
  2. rubygamestudios

    rubygamestudios

    Joined:
    Jan 7, 2018
    Posts:
    3
    Hello @garv3 ,

    I am having the exact same problem for more than 5 months. I have 2 games to publish after I setup google play games. Did you solve the problem ?