1

I've created a custom module to use the Google MyBusiness (GMB) API to get reviews etc for a specified location.

The issue I am having at the moment is authenticating. All the examples I have read suggest a two step process, first, get an access token, then make actual API call to request reviews.

The above requires setting up a redirect URL for google to send the authentication response, as far as I understand it. The questions I had were

After setting up the Google client library how do you handle the RedirectUrl in the context of http://localhost:81 (My local dev server which I doubt is possible considering google wont know who localhost is) ....or is it possible to have . permanent AccessToken for this which is stored in the config and simply make immediate calls to the Google API, much like Twitter allows for posting tweets automatically.

It would be nice to simply be able to do a Guzzle request to a Google API endpoint with attached accesstoken and skip the handshaking and requestAccessToken step.

Regards and Thanks John

  • It would be nice to simply be able to do a Guzzle request to a Google API endpoint with attached accesstoken and skip the handshaking and requestAccessToken step. That would kind of negate the point of using OAuth though. I think you're over-thinking the redirect URL a bit. The OAuth provider will literally redirect to that URL with the token once it's completed, it's not a background API call like an IPN notification from a payment processor or similar. As long as your computer can access localhost, that's where you'll end up when the process finishes – Clive Dec 19 '18 at 14:28
  • @Clive Cheers for the response. So with the request I can simply set the redirect url to some PHP script or RESTful URL to process and extract the returned accessToken or error ? – John Cogan Dec 20 '18 at 11:27
  • That's the theory, yeah. As long as the user going through the process's network can access the redirect URL, there shouldn't be any reason for it not to work – Clive Dec 20 '18 at 11:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.