Hi.
I am performing an integration with Google My Business API.
I’m having trouble getting GET: GET https://mybusiness.googleapis.com/v4/accounts. I thank you for your help.
https://developers.google.com/my-business/reference/rest/v4/accounts/list
If you look towards the bottom of the page, you will see that you need a specific set of authorisation scopes for this.
How you get these really depends on how you intend the app to work. Is someone signing up with their google account?
Authentication worked, now I’m having trouble configuring calls.
In this case, the client will authorize my app to access his GMB account
Perhaps you’re already aware, but unlike most other Google API’s, a developer must request and be granted access to this one. See step 4 on this page. If you’ve already done that, then disregard this post.
Yes, I already have the API authorized and active.
-
I did the authentication process.
-
Now I need to make the calls, but I don’t know what to insert in the header
Each and every call to an API endpoint must be authenticated. Have you set things up to send the access token in the header for each call? Maybe the Authorization
header needs to be a shared header?
I ran a test like this: I ran a test like this: https://mybusiness.googleapis.com/v4/accounts Authorization: Bearer [access_token]
Thus this error appeared:
You’re trying to use the header in the URL, and that just isn’t going to work. The error is saying that URL doesn’t exist (which it doesn’t).
And while it’s possible to use the access token in a query string parameter, Google recommends against it. I think you need to set up a shared header. See the second screen shot you posted.
Thank you for your help.
It was missing to insert the bearer token in the shared header.
One more doubt. How do I generate the token in an automated way every time the user logs in, today I’m using OAuth 2.0 Playground for testing.