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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Google Play Games - problem with authentication

Discussion in 'Android' started by SuperSharpBanana, Jan 3, 2015.

  1. SuperSharpBanana

    SuperSharpBanana

    Joined:
    Sep 17, 2014
    Posts:
    8
    Hello,

    I'm using Google Play Games plugin ( https://github.com/playgameservices/play-games-plugin-for-unity ), version 0.9.11 (latest).

    I'm not able to pass authentication step on Android, trying also on "Minimal" sample. The error I get from adb logcat is:

    [Play Games Plugin DLL] 01/03/15 23:05:46 +01:00 DEBUG: Starting Auth Transition. Op: SIGN_IN status: ERROR_NOT_AUTHORIZED

    In app I get a login prompt, then I am asked to accept licence agreement, and then after loading indicator it simply fails.

    Anybody had similar problem? I was looking over internet for some solution but didn't find anything.

    Interesting fact may be that when trying to run setup from File -> Play Games Android Setup, I get a warning:

    "The version of your copy of Google Play Services Library Project could not be determined. Please make sure it is at least version 6111000. Continue?"

    So maybe this is a hint. But when I checked in libproject\google-play-services_lib\res\values\version.xml, my version is 6587000
     
  2. PGJ

    PGJ

    Joined:
    Jan 21, 2014
    Posts:
    897
    The warning is quite normal and shouldn't affect your login process.
     
  3. SuperSharpBanana

    SuperSharpBanana

    Joined:
    Sep 17, 2014
    Posts:
    8
    Anybody had such problem? If the warning is normal - that's great, thanks for your answer. But still have no idea why I cannot authenticate.
     
  4. spotavi

    spotavi

    Joined:
    Aug 30, 2014
    Posts:
    31
    the latest build of unity google plugin has issue. Try an older version.

    Also check the sample scripts. One needs to call activate the plugin before using it .
     
  5. SuperSharpBanana

    SuperSharpBanana

    Joined:
    Sep 17, 2014
    Posts:
    8
    @spotavi thanks for your answer.

    As I said, I've tried on sample (Minimal), and also I'm sure I call activate, if you mean GooglePlayGames.PlayGamesPlatform.Activate() by that.

    I've tried on 0.9.11 and 0.9.10, where the issue also occurs. I didn't try on previous builds because I don't get "Setup on Android/iOS" buttons on them, so I don't know how to setup them.

    So the problem is still pending.
     
  6. SuperSharpBanana

    SuperSharpBanana

    Joined:
    Sep 17, 2014
    Posts:
    8
    Maybe this is the problem of Unity Free? Does this plugin work with free version?
     
  7. PGJ

    PGJ

    Joined:
    Jan 21, 2014
    Posts:
    897
    Yes, it works with free. Dunno, what can be wrong. Have you initialized the project with the setup menu? Have you set a proper application ID and Bundle Identifier?

    All I do is something along these lines:

    Code (CSharp):
    1. void Start()
    2. {
    3.     PlayGamesPlatform.Activate();
    4. }
    5.  
    6. void showHiScore()
    7. {
    8.     if (!Social.localUser.authenticated)
    9.     {
    10.         Social.localUser.Authenticate((bool success) =>
    11.         {
    12.             if (!success)
    13.             {
    14.                 // Couldn't connect, should probably show an error
    15.                 Debug.Log("Logging in; Failed");
    16.  
    17.                 return;
    18.             }
    19.         });
    20.     }
    21.  
    22.     Social.Active.ShowLeaderboardUI();
    23. }
    24.  
     
  8. SuperSharpBanana

    SuperSharpBanana

    Joined:
    Sep 17, 2014
    Posts:
    8
    I've found the reason why...
    The build has to be signed with keystore, even if this is just a development build. And this is the solution to the problem.
     
    PGJ likes this.
  9. qwarnant

    qwarnant

    Joined:
    Aug 21, 2014
    Posts:
    3
    Hello,

    I ran into the same issue but for me, I have signed the APK file with my release key and the problem was not solved. The authentication procress begins normally on my app (I have the Play Games pop-up and I must accept the app permission on my google account) but after, I see on the log the same error as SuperSharBan. I've tried to generate an Android Project to check if the AndroidManifest information are correct but the result project is totally corrupted.
     
  10. qwarnant

    qwarnant

    Joined:
    Aug 21, 2014
    Posts:
    3
    Okay, I found the problem.

    On the github repository of the plugin, I take this piece of code for the GPG initialization :

    Code (CSharp):
    1.     PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
    2.         // enables saving game progress.
    3.         .EnableSavedGames()
    4.         // registers a callback to handle game invitations received while the game is not running.
    5.         .WithInvitationDelegate(this.Debug)
    6.         // registers a callback for turn based match notifications received while the
    7.         // game is not running.
    8.         .WithMatchDelegate(this.Debug)
    9.         .Build();
    10.     PlayGamesPlatform.InitializeInstance(config);
    11.  
    The achievement report works very well when I removed this section in my init class on Unity. I think there is some issue in these lines but I don't know where.

    Moreover, I learned that I cannot set a custom percent value like 33.333. The value must be 0.0f for lock achievement and 100.0f for unlocking achievement. If you put a value greater than 0.0f, this value will be automatically considered to 100.0f. If you want to put custom steps on the achievement, you must use the increment achievement on the Google Play Console.
     
    Last edited: Jan 10, 2015
  11. kactus223

    kactus223

    Joined:
    May 20, 2014
    Posts:
    35
    I got that problem too. It's weird that if I let the plugin activate as its default, I can login and show Achievements and Leaderboard fine. But if I enable game cloud saving, I can not log in and got the same error log on android. There's seems a problem with google play cloud saving. I also tried replace Google Play Service Lib with the older version, both 6111000 (v20) and the latest one (v22).
     
  12. ahmad_arif

    ahmad_arif

    Joined:
    Feb 2, 2015
    Posts:
    1
    I got that problem too with unity 4.6.1f1 and GooglePlayGamesPlugin-0.9.11, is there a solution?
     
  13. MadMenyo

    MadMenyo

    Joined:
    May 15, 2013
    Posts:
    23
    I am having issues with matchmaking for a turn based game. I can view the achievements but cannot connect two players,a created game skips status automatching. Not sure if this is related but searching for hours for a solution and nothing on the interwebs.
     
  14. GDesmoulins

    GDesmoulins

    Joined:
    Apr 26, 2013
    Posts:
    7
    Hello Guys,

    After 2 days of tests with Authentification problems, (ERROR_NOT_AUTHORIZED)
    I spotted my mistake :
    "PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
    .EnableSavedGames()
    .Build();
    "
    I wrotted : ".EnableSavedGames()" but my game don't use it in Google Play interface, so the error occured !
    Simply removing it (for my part), and let's rock n roll !
     
    BYELIK and correia55 like this.
  15. teemukorh

    teemukorh

    Joined:
    Oct 28, 2014
    Posts:
    49
    I had this problem as well, because I didn't remember to add the user to the list of tester accounts in google play console.
     
    pcg, larku, Addyarb and 4 others like this.
  16. umer-azeem

    umer-azeem

    Joined:
    Dec 13, 2015
    Posts:
    2
    thanks buddy, you saved my day.
     
  17. Jabrils

    Jabrils

    Joined:
    Apr 10, 2015
    Posts:
    4
    oh my god i love you so much right now, thanks for ending a 3 day migraine!
     
  18. TopsLiked

    TopsLiked

    Joined:
    Jul 21, 2016
    Posts:
    1
    We are having the same issue! Were you able to solve the issue?
     
  19. Krempelj

    Krempelj

    Joined:
    May 17, 2015
    Posts:
    1
    I had the same problem. I used EnableSavedGames option in my configuration, but forgot to enable the option in the Google Play Developer Console. Hope this helps someone :)
     
  20. wayofthepigeon

    wayofthepigeon

    Joined:
    Aug 24, 2014
    Posts:
    1
    Late in the game but the EnableSavedGames fix helped me get things working (already had the test account set), thanks all! :)
     
  21. darkhelmet2005

    darkhelmet2005

    Joined:
    May 26, 2014
    Posts:
    9
    I just wanted to write and tell everyone that after spending at least 4 hours trying every suggestion I could find online, I realized that I had the Google Play Games app disabled on my phone. This is also something that needs to be enabled and up to date in order for authentication to work. I can't believe I spent so much effort trying all combinations of things to have that be the cause.
     
    InLifeApps likes this.
  22. Tkaewkunha

    Tkaewkunha

    Joined:
    Jun 28, 2016
    Posts:
    13
    SHA-1 certificate fingerprint is going to change after you push the App(.apk) on PlayStore.

    It mean.
    If you config Game Client using SHA-1 of published app on play store. And you test by apk that build from Unity on your computer you will get this error ERROR_NOT_AUTHORIZED

    But if you download the App from Playstore you will not see the error anymore. Because SHA-1 before and after publish on Play Store are different(I am not sure , am i understand it correct)

    I stuck with this for 5 hours.
    Hope this help anyone who has same issue.

    Read this https://support.google.com/googleplay/android-developer/answer/7384423?hl=en
     
    Last edited: Jan 4, 2018
    Radegast likes this.
  23. xysverma

    xysverma

    Joined:
    May 8, 2013
    Posts:
    10
  24. Radegast

    Radegast

    Joined:
    Dec 2, 2016
    Posts:
    3
    WOW. I stuck with this for 3 hours. Thank you. You are absolutely correct.
     
  25. taimur_azhar

    taimur_azhar

    Joined:
    Mar 19, 2015
    Posts:
    7
    Listen carefully. Copy SHA-1 from "Upload certificate", not "App signing certificate".
     
  26. dujin

    dujin

    Joined:
    Jan 13, 2018
    Posts:
    1
    Here's my video

     
  27. canyon_gyh

    canyon_gyh

    Joined:
    Aug 15, 2018
    Posts:
    47
    i has the question,this can solved ??
     
  28. mhmtemnacr

    mhmtemnacr

    Joined:
    Mar 7, 2013
    Posts:
    15
    I did that but still I get the error.