question

umutzenger avatar image
umutzenger asked

Google API error code: invalid_client Oath client was not found,Google API error code: invalid_client details: The OAuth client was not found.

Hi i'm trying to integrate google play services into our playfab backend. After some trial and error we have managed to successfully log the user into the google play services and retrieve a server auth code. However trying to link it to an existing user seems to be failing.

This is our code that runs at awake.

PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
    .AddOauthScope("profile")
    .RequestServerAuthCode(false)
    .RequestIdToken()
    .Build();
PlayGamesPlatform.InitializeInstance(config);
PlayGamesPlatform.DebugLogEnabled = true;
PlayGamesPlatform.Activate();

This runs to authenticate a user in:

Social.localUser.Authenticate(callback);

And finally after a 1 second delay we run the blow code:

Debug.Log("Trying to login.");
AuthId = PlayGamesPlatform.Instance.GetServerAuthCode();
Debug.Log($"Auth code is {AuthId}");
PlayFabClientAPI.LinkGoogleAccount(new LinkGoogleAccountRequest()
{
    ServerAuthCode = AuthId
}, AccountLinkSuccess, AccountLinkFail);

At which point our debug asserts that the login returns success, an oath code has indeed been provided but the API call to google returns the error : `invalid_client details: The OAth client was not found.`

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

·
Hernando avatar image
Hernando answered

This is usually because your Google OAuth Client ID is incorrect, please follow this guide and double-check the availability of Google OAuth Client ID and Google OAuth Client Secret. Trim the leading and trailing white space from both they may be helpful for you.

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.

umutzenger avatar image umutzenger commented ·

I can't believe that's what it was. I was sure to check any trailing with space but turns out i had a leading one. Thank you so much!

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.