API is not returning accounts and neither locations[ Edited ]
January 2017 - last edited January 2017 by Shalini S
Re: API is not returning accounts and neither locations
Hi @Marc M,
If you are building a service account application, please check out this Accepted Solution to set up your service account application for different Google Accounts. Please make sure that you request user consent and specify the user to impersonate for the Google Account to access its Google My Business data.
For sharing access to a large set of locations with a group of people, please also check out the best practices for using Business Accounts with Google My Business locations in the FAQ.
The Google My Business API team
API is not returning accounts and neither locations
hi @Shalini S,
I need to use the API from server side using a Cron Job, so I can not autenthicate usinng oauth2 with user consent.
So I'm connecting to API using a service account key, I created a new location using the API and the response is ok (200), but now when I access in My business Web Panel I can't see this new location created.
Where is the problem?
Re: API is not returning accounts and neither locations[ Edited ]
February 2017 - last edited February 2017
Hi @Marc M,
Since you are building a service account application, you still have to request user consent involving human interaction for each Google Account that you need to access the Google My Business data from and manually authorize your app during OAuth 2.0 flow at least once prior to authenticating with the public/private key pair. You can request user consent using OAuth 2.0 installed applications flow, OAuth 2.0 web server applications flow or via OAuth 2.0 Playground. However, you don’t have to save your retrieved refresh tokens for a service account application. Instead, you specify the user to impersonate by specifying the email address of the user account for access to their Google My Business data when you prepare to make authorized API calls. This is because a service account is an account that belongs to your application instead of an individual end user with a Google Account. Please check out this Accepted Solution for requesting user consent for a service account application.
As you mentioned you are unable to see location in Google My Business UI, the reason is a service account's generated email address is not equivalent to a Google Account’s email address. You can't sign in with your service account's email address to access the Google My Business UI. Therefore, the locations you created in your service account are not accessible via the UI and can’t be verified.