Unity Google Play Games plugin - Sign in/Authentication not working

Hi there,

I tried everything and I am stuck with this issue for days now. Whatever I try, the sign in screen from Google Play opens in the app but then suddenly stops and the user is not signed in.

Before sharing the code I will sum up the things I have done:

  • Imported GPG plugin for Unity, latest version, also tried older versions but same result. I did the setup, tried force resolve on the jar resolver.
  • Created build signed with a keystore
  • Uploaded signed APK to a internal test track
  • GPG link in playstore is set up correctly
  • Tried installing the app manually and through playstore
  • Created a new project to only test the Sign in part of GPG, the code I will share will be of this test project
  • Tried changing SHA1 keys in the API console, tried every possible combination of APK install (Playstore/manual) and SHA1 key (Signed, Upload)
  • Added test emails to the test track of myself and my colleague, and enabled those emails to test.

I hope someone can help me. I can’t find anything on the internet anymore and can’t seem to figure this one out myself. This is the only thing blocking us from publishing our first game.

This is all the code I am using for the test app. I added a button in the scene to sign in to GPG and 1 text field to show a status string.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using GooglePlayGames;
using GooglePlayGames.BasicApi;
using GooglePlayGames.BasicApi.SavedGame;
using UnityEngine.UI;

public class ClickManagerScript : MonoBehaviour
{

    public GameObject textField;

    public void LogInClick()
    {
        PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
            .EnableSavedGames().Build();
        PlayGamesPlatform.DebugLogEnabled = true;
        PlayGamesPlatform.InitializeInstance(config);
        PlayGamesPlatform.Activate();

        SignIn();
    }

    void SignIn()
    {
        //when authentication process is done (successfuly or not), we load cloud data
        Debug.Log("Going to log in to GPG");
        Social.localUser.Authenticate(success => { UpdateTextField(); });
    }

    void UpdateTextField()
    {
        Text text = textField.GetComponent<Text>();

        if (Social.localUser.authenticated)
        {
            text.text = "Sign in succesfull";
        }
        else
        {
            text.text = "Sign in failed";
        }
    }
}

I’ll tag along on this one. I’m having the same issues, following exactly the same steps as you did. Looking at the code, it is pretty similar as well.

For the people seeing this post and having the same issue: disable savedgames in your code and sign-in will work. Cloud saving is broken right now. The most recent comments on the link below goes about this issue. Hope Google fixes it soon, cloud saving is quite handy for saving IAP purchases etc.