Closed GabrieleRastelli closed 2 years ago
Hi everyone,
I finally managed to get a serverAuthCode with the following code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using GooglePlayGames;
using GooglePlayGames.BasicApi;
using UnityEngine.UI;
using UnityEngine.SocialPlatforms;
public class GPGSManager : MonoBehaviour
{
private PlayGamesClientConfiguration clientConfiguration;
void Start()
{
ConfigureGPGSForToken();
SignIntoGPGS(SignInInteractivity.CanPromptOnce, clientConfiguration);
}
internal void ConfigureGPGSForToken()
{
clientConfiguration = new PlayGamesClientConfiguration.Builder()
.RequestServerAuthCode(false)
.Build();
}
internal void SignIntoGPGS(SignInInteractivity interactivity, PlayGamesClientConfiguration configuration){
configuration = clientConfiguration;
PlayGamesPlatform.InitializeInstance(configuration);
PlayGamesPlatform.DebugLogEnabled = true;
PlayGamesPlatform.Activate();
PlayGamesPlatform.Instance.Authenticate(interactivity, (code) =>
{
if(code == SignInStatus.Success){
string token = PlayGamesPlatform.Instance.GetServerAuthCode();
} else {
/* whatever */
}
});
}
}
And I also had to change my credential configuration as I was using "Android" instead of "Web application".
Hope this can be helpful.
Thanks
Hi everyone,
I'm trying to authenticate with GPGS on my mobile unity game in order to get a server auth code to send to my server.
This is the code i'm using:
but i always end in the else statement with "DeveloperError" as code.
I can't find anything helpful in the logs:
If I try to authenticate with this configuration:
It works fine but i can't get the server auth code.
I already checked my clientId and added the correct email as tester.
What else can I try to do in order to solve my problem?
Thanks