question

velidvrabac avatar image
velidvrabac asked

Google API error code: unauthorized_client details: Unauthorized

Hi, I'm trying to connect account with the google. I'm using unity, and external service to log in (not google games service) and get auth code. But after I call PlayFab LoginWithGoogle and pass this auth code, I got following error:

Google API error code: unauthorized_client details: Unauthorized

This error is not same as: "Google API error code: invalid client details: unauthorized".

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

·
brendan avatar image
brendan answered

How did you generate your Client ID and Secret? If you didn't choose the Web Application type, can you go back to your Google project and re-generate them using that type? There's a fairly complete overview of their OAuth2 system here: https://developers.google.com/adwords/api/docs/guides/authentication#configure_and_use_a_client_library

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

velidvrabac avatar image velidvrabac commented ·

I choose the Web Application.

At first my problem was with client id and I got the error:

Google API error code: invalid client details: unauthorized

But after I got fixed I got this error I posted.

0 Likes 0 ·
brendan avatar image brendan velidvrabac commented ·

Can you confirm that you've followed all the steps in this tutorial (https://api.playfab.com/docs/tutorials/landing-players/sign-in-with-google)? What access rights are you requesting for your title?

0 Likes 0 ·
velidvrabac avatar image velidvrabac brendan commented ·

I was watching this, but I did not use a google game service.

I used this service to get data from Google (name, email, AUTH CODE). After I get Auth Code and call LoginWithGoogle I got the error I posted.

OAuth2 google api work perfectly for iOS, but I don't know if it works for the web when it connects the playfab.

So far, I have made a solution so that I fetch data from google and register custom on the playfab, but that is not a good solution.

0 Likes 0 ·
Show more comments
velidvrabac avatar image velidvrabac commented ·

@Brendan

It can't be a problem with the GitHub library, because I successfully login and get valid data. After I got AuthCode from the library, the rest of the deal is between the PlayFab and the Google.

I don't see where it can be a problem because I have checked many times the client id and the secret that it is well set up.

0 Likes 0 ·
brendan avatar image brendan velidvrabac commented ·

The "Unauthorized" error specifically means that the authentication credentials passed in did not pass the check with Google. Bear in mind that Google have introduced a number of different auth systems over time. The LoginWithGoogleAccount API call specifically works with Google's OAuth 2.0 credential system, as described here: https://api.playfab.com/documentation/client/method/LoginWithGoogleAccount.

Given that, what specifically do you mean when you say you log in and get data? You originally were saying that login did not work. If you're logging in with Client/LoginWithGoogleAccount, what is the error you're encountering at this point?

0 Likes 0 ·
velidvrabac avatar image velidvrabac brendan commented ·

The confusion came because of my bad English.

When I'm going to log in via google to playfab (Client/LogInWithGoogleAccount), I need to have the "AuthCode".

To get AuthCode I need to log in to the google, and get AuthCode.

In the tutorials you post here, you used the google game service to get AuthCode, but I'm using third library for that.

I say it's not up to that library because I successfully get the auth code, as I would get from the google game service. I'm not using Google Game Service because of deprecation for iOS.

When I log in with third library to the google, and get the AuthCode than It failed to log in with that auth code to playfab (Client/LoginWithGoogleAccount).

I hope that You understand me now.

0 Likes 0 ·
Show more comments

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.