大家好,又见面了,我是你们的朋友全栈君。
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.proxy.ustclug.org
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 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.proxy.ustclug.org/auth/gmail”,
“token_type”: “Bearer”,
“expires_in”: 3600,
“refresh_token”: “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”
}
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/155358.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...