question

Dustin avatar image
Dustin asked

Trouble with LoginWithGoogleAccount

I am following the guide here: https://api.playfab.com/docs/tutorials/landing-players/sign-in-with-google

I am able to login to google on my device, and get the server auth code. However, when I try to login to playfab with that serverauthcode I get an error that I don't know how to diagnose:

"Google API error code: invalid_client details: Unauthorized"

LoginWithGoogleAccountRequest request = new LoginWithGoogleAccountRequest();
                request.ServerAuthCode = serverAuthCode; //confirmed it has a value
                request.TitleId = titleId;	//confirmed this is correct
                request.CreateAccount = true;


                PlayFab.PlayFabClientAPI.LoginWithGoogleAccount(request, playFabOnLoginResult, playFabOnError);

I'm hoping someone has seen this before because Google shows no results for that error.

I've set up the Google addon, as far as I know it's correct. I don't know what to do with this error as it comes from PlayFab's server.

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

·
Andy avatar image
Andy answered

The first thing I would do is double-check the Google OAuth client id and client secret you've provided to us on the Add-ons page in the Game Manager for your title. The most common cause of that error is missing or invalid values there.

1 comment
10 |1200

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

Dustin avatar image Dustin commented ·

Oh man you wouldn't believe it, I checked and double checked and triple checked, spent hours on this. There was a space at the end of the client secret in the playfab console. I even thought I checked for that. Dang you should trim spaces on user input ;-)

Thanks, working now!

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.