question

MIKHAIL SPITSYN avatar image
MIKHAIL SPITSYN asked

[AIR] Google Login "InvalidGoogleToken"

Project: 349B

token example: 

data = "ya29.GlyeBOxcxkc35_3Bm_Yk1BjXa9Pse2NvPVIZICSOcCTfaq422hQyv8ki4kIPt8RwjRTH1MEL-qgvl2vHsie3IVprNlptie8crIVIGd1YTlGn_BqANGrKsALtJV3k7Q"
var request:LoginWithGoogleAccountRequest = new LoginWithGoogleAccountRequest();
request.TitleId = PlayFabSettings.TitleId;
request.ServerAuthCode = e.content.token;
request.CreateAccount = true;
PlayFabClientAPI.LoginWithGoogleAccount(request, onCompleteLoginGP, onErrorLoginGP);

Client ID for Web application Setup:

error : 
com.playfab.PlayFabError
{ 
error : "InvalidGoogleToken" 
errorCode : 1026 [0x402] 
errorDetails : null 
errorMessage : "Google API error code: invalid_grant details: Incorrect token type." 
httpCode : 400 [0x190] 
httpStatus : "BadRequest"
} 

What am I doing wrong?

rs-google-is.png (40.3 KiB)
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

Can you please confirm that you have added "profile" to the scope you're requesting (https://api.playfab.com/docs/tutorials/landing-players/sign-in-with-google)? That's a common cause of this error.

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

MIKHAIL SPITSYN avatar image MIKHAIL SPITSYN commented ·

what do you mean by added profile?

this?

0 Likes 0 ·
screenshot-3.png (34.7 KiB)
brendan avatar image brendan MIKHAIL SPITSYN commented ·

I mean the OAuth profile scope, which must be set for the auth code to be valid. In the tutorial I linked above, have a look at the section titled "Adding Google Sign-In to your Unity Game". It described specifically how to make sure you're requesting the correct scope from GPG.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.