Search Unity

Play Store Unity Plugin, Authentication Fails

Discussion in 'Android' started by Virdari, Sep 6, 2015.

  1. Virdari

    Virdari

    Joined:
    Aug 19, 2014
    Posts:
    14
    So I downloaded the plugin for the Play Store. Also did all the prerequisite mentioned in the readme file. Play Store Developer Console settings and such. I added a gmail account for testing to the app which I added to the game services tab. I created the sha-1 certificate and plugged it in. Also added the application ID to the Google Play Games -> Android ->Setup section. Added my e-mail to the testers tab. Everything seemed okay up to this point. I added the Minimal scene and ran it on my android.
    >Clicked on authenticate
    > asked for the sign in part, clicked on sign in.
    > Play store logo shows up ActivityIndicator starts spinning after a while it stops indicating that the authentication returned something and the problem is that It always fails.
    Do I have to publish my apk on alpha testing for the authentication to work ? I haven't used the play store plugin & API before. What did i miss here?

    EDIT:
    Here is how i fixed it.

    Normally you would put your sha-1 certificate in the google play store dev console page and the app would get linked there. Everything looks alright from that end (green tick)
    The problem lies on the google back end console. (google developer console)

    1) Go to :https://console.developers.google.com/project/YOURPROJECTID/apiui/credential
    (replace your project id with <YOURPROJECTID>)
    2)Click on your project's name.
    3) Check if you have SHA-1 Fingerprint set there. My textfield was empty. Just manually entered the same SHA-1 certificate I had entered into the Google Play Store Console and immediately after that tested my authorization and now I'm in ! :)

    On the other hand this means that linking the app on google play stores developer console is broken and doesn't somehow add the SHA-1 to the credentials page on the backend console. Google fix pls.
     
    Last edited: Sep 7, 2015
  2. Virdari

    Virdari

    Joined:
    Aug 19, 2014
    Posts:
    14
    Here is how i made my sha-1 certificate :
    (Player Settings -> Publishing Settings of Android)
    1- Press create new keystore button
    2- Select a directory and a name for your keystore
    3-Enter a keystore password
    4-Confirm your password
    5-Click on Unsigned (debugkey)
    6-Click on Create new key selection under the Unsigned
    7-Create your key. Enter a password for that specific key. (NOT THE KEYSTORE)
    8-Now you will have a keystore and an alias.
    9- Go to your JDK file. Usually something like C:\Program Files\Java\jdk_1.x.xxx\bin\
    10- Use the keytool utility to sign your keys and get a SHA-1 certificate which you will plug in for the Oauth2 Client ID, during the authorization process of your app, in Google Play Store Services.
    11- Open a command line tool and change directory to jdk1.x....\bin\ file where keytool resides.
    12- type keytool -exportcert -v -list -alias <your-alias-name> -keystore <path-to-your-keystore-file>
    13-It will ask for the password which you entered for the Alias during Step 7. Enter it again
    14- You will get your certification. Among them will be the SHA-1 Certificate. Copy paste it to the Play Store Services page.
    15- You've made it !
     
  3. Joishi

    Joishi

    Joined:
    May 9, 2015
    Posts:
    7
    I´m Having the same problem, I already tried to replace de "social" for "PlayGamesPlatform.Instance" and doesnt work,
    this is my code

    Code (CSharp):
    1.  public void Start()
    2.     {
    3.  
    4.                PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
    5.              .Build();
    6.         PlayGamesPlatform.InitializeInstance(config);
    7.      
    8.         PlayGamesPlatform.DebugLogEnabled = true;
    9.      
    10.         PlayGamesPlatform.Activate();
    11.  
    12.     }
    13. ......
    14.  
    15. if (GUI.Button(new Rect(Screen.width / 2 - 50 + 5, Screen.height / 2 - 100, 140, 20), "Log in"))
    16.         {
    17.             //This part of code never success, I always get the "else" code(this code is just for
    18.             // test the log in)
    19.             Social.localUser.Authenticate((bool success) => {
    20.                 if (success)
    21.                 {
    22.                     test = "logeado con exito";
    23.                 }
    24.                 else
    25.                 {
    26.                     test = "Falla de logeo";
    27.                 }
    28.             });
    29.  
    30.         }
    Thanks for any help.
     
    Last edited: Sep 7, 2015
  4. Virdari

    Virdari

    Joined:
    Aug 19, 2014
    Posts:
    14
    I fixed my problem. The solution is in the original post