Problem implementing google oauth authentication

Hi,

I am trying to implement google oauth login for my unity game. Am currently doing the following stuff

  void Start()
    {
        PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
        .AddOauthScope("email")
        .AddOauthScope("profile")
        .AddOauthScope("https://www.googleapis.com/auth/games")
        .AddOauthScope("https://accounts.google.com/o/oauth2/auth")
        .Build();

        PlayGamesPlatform.InitializeInstance(config);
        // recommended for debugging:
        PlayGamesPlatform.DebugLogEnabled = true;
        // Activate the Google Play Games platform
        PlayGamesPlatform.Activate();
        //PlayGamesPlatform.Instance.Authenticate(GetData);
        Social.localUser.Authenticate(GetData);
    }

when a button is pressed

 public void OnButtonPress()
    {
        PlayGamesPlatform.Instance.GetServerAuthCode(AuthoResponse);
    }

private void AuthoResponse(CommonStatusCodes result,string status)
    {
        Debug.Log("status of autho:"+result.ToString()+"

Status:"+status);
}

the above code returns a internal error when “GetServerAuthCode” method is called. I have tried to get access token using “PlayGamesPlatform.Instance.GetAccessToken()” it doesn’t return any data.

I searched for documentation, but there was not much related to unity. Can you please point me in the right direction.

Thank you.

I had no luck with this either but you can call RequestServerAuthCode(false) now (at least with the 0.9.42 version of gpgs) and also there is RequestEmail() for PlayGamesPlatform.Instance. They still return null for my end right now but maybe that’ll help you :slight_smile: