0

I am working on the GMB API, facing some issues. I have implemented Google Oauth at frond-end and saving user listing in my DB. Now I want to run cron job in which I want to get those user`s listing insights. So issues are here

1: I can't find GMB API samples or doc regarding GMB stuff(I have read all google-api-php-client doc). Here are GMB samples but it doest have PHP samples. https://github.com/google/google-my-business-samples

2: Second thing is that I don't want to open consent(Google Account Selector Popup) to get the user's permission because its a backend process. So what type of process should I follow a) Oauth OR b)Service Account.

If I use the Oauth process then I have to save access_token in the database when the user first time gives permission at the front end of the website and uses that token as refresh token to get the new access token in PHP and call GMB APIs. But the issue is that we have already registered 500+ users, so how I will get their access token because they are already done with google permissions.

I didn`t try yet with a service account. I am using Laravel 5.7 version.

glinda93
  • 7,659
  • 5
  • 40
  • 78
  • What have you tried so far? Where are you stuck? The second thing looks pretty obvious to me: if somebody logs in using OAuth, and the mail address is already stored in your database, why not use that user? – Nico Haase Aug 13 '20 at 06:07
  • @NicoHaase First thing is that I can`t find any sample code of PHP GMB, second is that as you mentioned that we have email address than How we can get listing data of a user using user email address? – link2developer Aug 13 '20 at 07:37
  • In very simple words, I have shared listings and now I want to get stats etc of those shared listings using GMB PHP API. – link2developer Aug 13 '20 at 07:38
  • I have resolved it on my own. – link2developer Dec 07 '20 at 15:19

0 Answers0