playgameservices / play-games-plugin-for-unity

Google Play Games plugin for Unity
Other
3.43k stars 954 forks source link

SignInRequest Setting result error status code to: 16 (Google play services + firebase) #3060

Closed kx23 closed 2 years ago

kx23 commented 2 years ago

Hello, I am trying to integrate Google Play Games Services and Firebase into my game project.

I setup firebase using this tutorial. Then i add Play Games Plugin to my project and follow next instructions. Next i create simple script

public class LeaderBoard : MonoBehaviour
{
    string authCode;
    private const string leaderBoard = "CgkIs9rTtuYFEAIQAg";
    // Start is called before the first frame update
    void Start()
    {

        PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
            .RequestServerAuthCode(false /* Don't force refresh */)
            .Build();

        PlayGamesPlatform.InitializeInstance(config);
        PlayGamesPlatform.Activate();

        Social.localUser.Authenticate((bool success) => {
            print("Authentication: " + success);
            if (success)
            {

            }
            else
            {

            }
        });

    }

}

and add it to my start scene. I also add aab file for Internal testing in the Google Play console and add my email for tests (in OAuth consent screen too).

I have error when i build and run apk on my phone and when i create aab, add it to Internal testing and download from play market.

This is the log snippet I get from Android Logcat

0001.01.01 00:00:00.000 -1 -1 Info --------- beginning of system 2021.08.22 16:24:20.152 23065 23065 Warn Activity Slow Operation: Activity com.SkyERed.SchoolBreaker/com.unity3d.player.UnityPlayerActivity onPause took 51ms 2021.08.22 16:24:20.173 23065 23065 Warn ActivityThread handleWindowVisibility: no activity for token android.os.BinderProxy@199653c 2021.08.22 16:24:20.191 23065 23065 Info Timeline Timeline: Activity_launch_request time:354752055 2021.08.22 16:24:20.206 23065 23065 Debug ForceDarkHelper updateByCheckExcludeList: pkg: com.SkyERed.SchoolBreaker activity: com.google.android.gms.auth.api.signin.internal.SignInHubActivity@26c9641 2021.08.22 16:24:20.206 23065 23065 Debug ForceDarkHelper updateByCheckExcludeList: pkg: com.SkyERed.SchoolBreaker activity: com.google.android.gms.auth.api.signin.internal.SignInHubActivity@26c9641 2021.08.22 16:24:25.543 23065 23065 Error SignInRequest Setting result error status code to: 16 2021.08.22 16:24:25.559 23065 23065 Info Unity Returning an error code. 2021.08.22 16:24:25.559 23065 23065 Info Unity GooglePlayGames.Android.<>cDisplayClass18_0:b__0(Int32) 2021.08.22 16:24:25.559 23065 23065 Info Unity System.Action1:Invoke(T) 2021.08.22 16:24:25.559 23065 23065 Info Unity System.Action1:Invoke(T) 2021.08.22 16:24:25.559 23065 23065 Info Unity System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo) 2021.08.22 16:24:25.559 23065 23065 Info Unity UnityEngine.AndroidJavaProxy:Invoke(String, Object[]) 2021.08.22 16:24:25.559 23065 23065 Info Unity UnityEngine._AndroidJNIHelper:InvokeJavaProxyMethod(AndroidJavaProxy, IntPtr, IntPtr) 2021.08.22 16:24:25.559 23065 23065 Info Unity 2021.08.22 16:24:25.564 23065 23065 Debug AudioManager getStreamVolume isRestricted mode = 0 2021.08.22 16:24:25.566 23065 23065 Debug HelperFragment onResume called 2021.08.22 16:24:25.599 23065 23065 Verbose MediaRouter Selecting route: RouteInfo{ name=Телефон, description=null, status=null, category=RouteCategory{ name=Система types=ROUTE_TYPE_LIVE_AUDIO ROUTE_TYPE_LIVE_VIDEO groupable=false }, supportedTypes=ROUTE_TYPE_LIVE_AUDIO ROUTE_TYPE_LIVE_VIDEO , presentationDisplay=null } 2021.08.22 16:24:25.613 23065 23094 Debug AudioManager getStreamVolume isRestricted mode = 0 2021.08.22 16:24:25.619 23065 23094 Info Unity Authentication: False 2021.08.22 16:24:25.619 23065 23094 Info Unity <>c:b2_0(Boolean) 2021.08.22 16:24:25.619 23065 23094 Info Unity System.Action1:Invoke(T) 2021.08.22 16:24:25.619 23065 23094 Info Unity System.Action2:Invoke(T1, T2) 2021.08.22 16:24:25.619 23065 23094 Info Unity GooglePlayGames.<>c__DisplayClass33_0:b__0(SignInStatus) 2021.08.22 16:24:25.619 23065 23094 Info Unity System.Action1:Invoke(T) 2021.08.22 16:24:25.619 23065 23094 Info Unity System.Action1:Invoke(T) 2021.08.22 16:24:25.619 23065 23094 Info Unity System.Action:Invoke() 2021.08.22 16:24:25.619 23065 23094 Info Unity GooglePlayGames.OurUtils.PlayGamesHelperObject:Update() 2021.08.22 16:24:25.619 23065 23094 Info Unity

This is my first time doing this and I think I'm missing out on something simple and important. For the fourth day I have been reading the forums and trying to fix this, but no solution works for me. I would be glad for any help and provide additional information if it needed. Thank you in advance.

M1raclee commented 2 years ago

Have same problem for 2/3 of users of my game (by analytics data) But i can't reproduce this problem on my devices. Maybe google play games has special policy for EU, for example?

aTasja commented 2 years ago

Same error.

E/SignInRequest: Setting result error status code to: 16

Unity 2020.3.17f1 play-games-plugin-for-unity v10.12 release

But plugin v10.09 works fine with Unity 2019.3.15.

Any ideas?

UPDATE! Problem solved by adding Release Track to Testers. Google Play Console ->your app ->Play Game services -> Testers -> Release tracks -> add track

LobbyDivinus commented 2 years ago

I have exactly the same issues but adding release tracks didn't solve it. Any more ideas on what to try?

aTasja commented 2 years ago

I have exactly the same issues but adding release tracks didn't solve it. Any more ideas on what to try?

Have you added testers in services on Google Play? Google Play Console --> PlayGame Services --> Testers --> an inset "Testers"

LobbyDivinus commented 2 years ago

Yes, I have done that. I also compared the configuration to another project where Google Play Games is working but I did not find any differences.

aTasja commented 2 years ago

Yes, I have done that. I also compared the configuration to another project where Google Play Games is working but I did not find any differences.

Did you configure the Google Cloud Platform and publish the services?

My cloud platform has two OAuth 2.0 Client IDs per game. One is for debugging, the second is for production. SHA-1 certificate fingerprints are the same as in Google Play Console --> Setup --> App Integrity

So the SHA-1 certificate fingerprint in the App signing key certificate is for production. And the SHA-1 certificate fingerprint in the Upload key certificate is for debugging.

LobbyDivinus commented 2 years ago

Thank you @aTasja , creating another OAuth 2.0 client for the debug fingerprint and adding it in Games configuration did the trick indeed.

At this point I'm wondering why this was not setup by the console automatically like the client for the production key. I falsely assumed I would only have to create another client in case I would like to connect from a game server.

aTasja commented 2 years ago

Thank you @aTasja , creating another OAuth 2.0 client for the debug fingerprint and adding it in Games configuration did the trick indeed.

At this point I'm wondering why this was not setup by the console automatically like the client for the production key. I falsely assumed I would only have to create another client in case I would like to connect from a game server.

I am very glad that the problem was solved.