get authorization code:
request:
https://accounts.google.com/o/oauth2/v2/auth
?redirect_uri=https://developers.google.com/oauthplayground
&prompt=consent
&response_type=code
&client_id=407408718192.apps.googleusercontent.com
&scope=https://mail.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://developers.google.com/oauthplayground
&client_id=407408718192.apps.googleusercontent.com
&client_secret=************
&scope=
&grant_type=authorization_code
response:
http/1.1 200 ok
content-length: 583
x-xss-protection: 1; mode=block
x-content-type-options: nosniff
transfer-encoding: chunked
vary: origin, x-origin, referer
server: esf
-content-encoding: gzip
cache-control: private
date: fri, 15 mar 2019 06:36:45 gmt
x-frame-options: sameorigin
alt-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"
}