question

tufanuyguner avatar image
tufanuyguner asked

Google OAuth2, Unity WebGL returns `redirect_uri_mismatch`

Hello, I wonder what I should add to authorized redirect URIs to solve this issue?

{"code":400,"status":"BadRequest","error":"GoogleOAuthError","errorCode":1271,"errorMessage":"Google API error code: redirect_uri_mismatch details: Bad Request"}

I already added my playfab API endpoint and the "oauth.playfab...." link. I get code from my own backend and send it to PlayFab using client API, it returns this response.

Authentication
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.

Rick Chen avatar image Rick Chen ♦ commented ·

Have you followed this tutorial to implement the Google sign-in? PlayFab authentication with Google Play Games Sign-In in Unity - PlayFab | Microsoft Docs. And how do you configure the Google API credential? You can check this similar thread: https://community.playfab.com/questions/47533/google-sign-in-error-redirect-uri-mismatchgoogle-s.html

0 Likes 0 ·
tufanuyguner avatar image tufanuyguner Rick Chen ♦ commented ·

Hi, I only partially followed that tutorial as my target platform is WebGL. I've checked all similar threads but couldn't solve the issue.

0 Likes 0 ·

1 Answer

·
JayZuo avatar image
JayZuo answered

As Google Play games services does not support WebGL, you may refer to Setting up PlayFab authentication using Google and HTML5 to implement Google login. The key point here is getting AccessToken from Google. And then using AccessToken instead of ServerAuthCode to log into PlayFab.

The following thread might be helpful for you, although its target platform is Desktop not WebGL, but this platform also does not have Google Sign-In support.

Google Windows Login (NOT GPG/Google Play as this is unavailable in Windows) - invalidGoogleToken

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.