- Home /
Get google token
How do i get google id token and access token for firebase?
I need them here:
Firebase.Auth.Credential credential =
Firebase.Auth.GoogleAuthProvider.GetCredential(googleIdToken, googleAccessToken);
Edit: Okey i found out that you can get token like this:
PlayGamesPlatform.Instance.GetToken();
But when i try it on my mobile phone script gets stuck at this line... help :O
Hi, did you find any solutions yet? Im looking for an answer to this issue too
Hullu Anyone have a decent answer for this? It seems like the answer posted is a work around.
Answer by Hullu · May 26, 2017 at 08:32 AM
This is my solution:
First setup playgames configuration like this
PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
.RequestIdToken()
.Build();
PlayGamesPlatform.InitializeInstance(config);
PlayGamesPlatform.Activate();
Then login using
Social.localUser.Authenticate
Now you can get token
googleIdToken = ((PlayGamesLocalUser)Social.localUser).mPlatform.GetIdToken();
and use it to login to firebase
Credential credential =
GoogleAuthProvider.GetCredential(googleIdToken, null);
auth.SignInWithCredentialAsync(credential)
I hope this helps
Did you try the google login on iOS as well? How would you retrieve the id and token there?
Your answer
Follow this Question
Related Questions
Looping Login Google Play Services 0 Answers
Unable to Login to Unity Hub With G Suite Account 0 Answers
Is there a way to set a unique token variable for each individual Unity client on download? 0 Answers
Do I need players to have accounts in order to have an IAP currency (ie. gems)? 1 Answer
Facebook login dialogue won't appear in VR projects 1 Answer