question

mohamed amine outmal avatar image
mohamed amine outmal asked

Google Login InvalidGoogleToken when sign in on website

hey ,

i've trying to create a new user on playfab usign loginwithgoogle endpoint (on web) using laravel framework and socialite plugins to get auth token from google then when register user usign this :

$data_body = [
"ServerAuthCode" => $userSocial->accessTokenResponseBody['access_token'],
"CreateAccount"=> true,
            ];
$result = PlayFabClientApi::LoginWithGoogleAccount(config('playfab.TitleId'),$data_body);

i got this error response :

{"code":400,"status":"BadRequest","error":"InvalidGoogleToken","errorCode":1026,"errorMessage":"Google API error code: invalid_grant details: Malformed auth code."}
10 |1200

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

Rick Chen avatar image
Rick Chen answered

I noticed that you used the access token as the ServerAuthCode in the line 2 of your code snippet. For google login on website, please follow this document: Setting up PlayFab authentication using Google and HTML5 and use the key “AccessToken” instead.

10 |1200

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

mohamed amine outmal avatar image
mohamed amine outmal answered

thank you so much dear ;) it working now

10 |1200

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

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.