Get Authorization code:
Request:
https://accounts.google.com/o/oauth2/v2/auth
?redirect_uri=https%3A%2F%2Fdevelopers.google.com%2Foauthplayground
&prompt=consent
&response_type=code
&client_id=407408718192.apps.googleusercontent.com
&scope=https%3A%2F%2Fmail.google.com
&access_type=offline
Response:
GET /oauthplayground/
?code=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
&scope=https://mail.google.com HTTP/1.1
Host: developers.google.com
Get Accesstoken:
Request:
POST /oauth2/v4/token HTTP/1.1
Host: www.googleapis.com
Content-length: 277
content-type: application/x-www-form-urlencoded
user-agent: google-oauth-playground
code=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
&redirect_uri=https%3A%2F%2Fdevelopers.google.com%2Foauthplayground
&client_id=407408718192.apps.googleusercontent.com
&client_secret=************
&scope=
&grant_type=authorization_code
Response:HTTP/1.1 200 OKContent-length: 583X-xss-protection: 1; mode=blockX-content-type-options: nosniffTransfer-encoding: chunkedVary: Origin, X-Origin, RefererServer: ESF-content-encoding: gzipCache-control: privateDate: Fri, 15 Mar 2019 06:36:45 GMTX-frame-options: SAMEORIGINAlt-svc: quic=":443"; ma=2592000; v="46,44,43,39"Content-type: application/json; charset=utf-8{ "access_token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "scope": "https://www.googleapis.com/auth/gmail", "token_type": "Bearer", "expires_in": 3600, "refresh_token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}