Forum Academy Marketplace Showcase Pricing Features

Issues connecting to Google API w/ Oauth2

Hello,

I’m trying to connect and authenticate with the Google Search Console API through Oauth2 User Agent Flow.

I think I’ve set up everything correctly for the most part but keep getting this error message:

image

And here is my config:

I feel like there’s something wrong with the user profile endpoint but I don’t know what else I should use.

Any help would be greatly apprechiated. :slight_smile:

I don’t think the user profile endpoint you’re using is correct. You need an endpoint that returns the user ID (for other Google APIs, it is https://www.googleapis.com/oauth2/v1/userinfo?alt=json)

2 Likes

Thanks for responding, found that URL somwhere on the Forum and tried it as well but no luck unfortunately.

It tells me that the API has not been configured properly…

image

If anyone has the same issue this solved my problem: Google Calendar API use case

So, you are basically not using the Login with social out of the box functionality? I was trying to add all of my scopes I need later in my app to the very beginning of the user’s Login / Sign Up flow. This way the refresh token process is in theory taken care of. Was really hoping not to have to manage that.

Seems like one of the last updates solved this issue (at least it did for me) and I can now use the standard “login with social” functionality (API connector with OAuth2)

@contact.aaron.alter would you mind sharing your API settings and the workflow? I’m really flying blind without having detailed errors.

What API are you trying to connect to / whats you’re use case. Maybe I can help you out…

Sheets / Classroom. I receive the same message for both.

@elliot.beaudoin No idea how much you know so I’ll just try to do it super basic just to be safe, also in case someone else sees this who might not have any idea.

Try the following config:
For 1) & 2) put in the “Client Secret” and “Client ID’s” from GCP in here.


-> Make sure that in GCP you authorize the correct URL (the one where you’re putting the button that has “login with social” workflow associated with it.)

For 3) use: https://www.googleapis.com/auth/documents - I’m guessing that’s the one for sheets…

For “login dialog redirect” paste: https://accounts.google.com/o/oauth2/auth?access_type=offline&approval_prompt=force
For “Access token endpoint” paste: https://www.googleapis.com/oauth2/v4/token
For “User profile endpoint” paste: https://www.googleapis.com/oauth2/v1/userinfo

Btw you can also add multiple scopes separated by a [space], so for testing purposes you could just try to use this scope:
https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email

And then do the following call to retrieve user info associated with the logged in account:

Hope this helps
Also test your calls on https://developers.google.com/oauthplayground/ always helped me with the setup.

3 Likes

hello, Thanks a lot for this.
I have a message

If I understood correctly It is because I did not :frowning:

unfortunatly I do not know How to do this : “setup a login workflow, run your app in run mode (with debug_mode=true in the URL) and authenticate with the service. Once done, your access token will be used to initate the API calls and the API will be marked as valid”.

thanks for your Help
Alex