question

patrick-4 avatar image
patrick-4 asked

LoginWithGoogleAccount redirect_uri_mismatch

I'm trying to use LoginWithGoogleAccount in a web app and I keep getting Google API error code: redirect_uri_mismatch details: Bad Request.

I've added https://<titleid>.playfabapi.com as an authorized JavaScript origin and https://oauth.playfab.com/oauth2/google as an authorized redirect URI.

I've also already configured the Google add-on with the client id and client secret in PlayFab.

I'm getting the ServerAuthCode from the Google OpenID flow and sending it to PlayFab via LoginWithGoogleAccount. Example request body:

{ "CreateAccount":false, "SetEmail":true, "ServerAuthCode":"auth code from google", "TitleId":"my title id" }

Am I'm missing something?

Thank you.

Authentication
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

·
JayZuo avatar image
JayZuo answered

When you say, "I'm getting the ServerAuthCode from the Google OpenID flow", do you mean you are using the authorization code that is returned from the initial request as the ServerAuthCode? From my understanding, this authorization code is not the ServerAuthCode needed in LoginWithGoogleAccount.

As the doc said, the ServerAuthCode should be

OAuth 2.0 server authentication code obtained on the client by calling the getServerAuthCode() (https://developers.google.com/identity/sign-in/android/offline-access) Google client API.

Since you are trying to use LoginWithGoogleAccount in a web app, I'd suggest you follow Setting up PlayFab authentication using Google and HTML5.

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.