Amin_it Amin_it - 4 months ago 104
Android Question

How to immediately get id token from google play services Unity Plugin

I'm using https://github.com/playgameservices/play-games-plugin-for-unity plugin to sign in user with his google account , and then i want to get Id Token and send it to my server and register an account for this user in my own database.this is my code to get Id token :

PlayGamesPlatform.Instance.Authenticate(success =>
{
if (success)
{
Debug.Log("Id Token :");
Debug.LogFormat("{0}", PlayGamesPlatform.Instance.GetIdToken());
Debug.Log("End Of Id Token");
}
});


The problem is the first time it prints just empty string , when i call this for the second time (or a moment later) it prints the token. I want to get token immediately or with a callback to make sure that token is recieved .

How to make sure that token is recieved? is there any callback for this?

Thanks

Answer

They changed the plugin in new version and now

PlayGamesPlatform.Instance.GetIdToken(Callback)

has a callback function.

Comments