php - Gmail API: How to get access token? -


i testing gmail api.

so far have done following:

so when run file quickstart.php gives link. when open it, appears authorization page authorize application access gmail api.

then redirects redirect uris have declared in setup (adding code parameter).

in address bar appears this:

http://localhost/main/gmail_callback?code=my_code

where main controller , gmail_callback far blank function.

and should correct since these settings:

  • javascript origins: http://localhost
  • redirect uris: http://localhost/main/gmail_callback

what do next?

the next step in flow exchange authorization code access token (which include refresh token if requested offline access). if use https://developers.google.com/oauthplayground/ execute flow manually, you'll able see urls involved. there php library call same thing, prefer send own http rather use library. if use library, still worth spending little time understand http flow can more debug problems encounter.


Comments