Abh*_*pta 7 youtube oauth youtube-api oauth-2.0 youtube-data-api
我按照本指南做服务器端oauth .
我顺利地完成了OAuth的,但我没有收到refresh_token在用于刷新和访问令牌兑换授权码的步骤:
请求:
POST /o/oauth2/token HTTP/1.1
HOST: accounts.google.com
content-type: application/x-www-form-urlencoded
content-length: 260
code=4/KEOuzih9jwfnHj7Rl1DeqHhcJF0goKPwtwR5IQ09ieg&client_id=****.apps.googleusercontent.com&client_secret=****&redirect_uri=http%3A%2F%2Flocalhost%3A8000%2FsSignIn.html&grant_type=authorization_code
Run Code Online (Sandbox Code Playgroud)
响应:
{
"access_token" : "****",
"expires_in" : 3580,
"token_type" : "Bearer"
}
Run Code Online (Sandbox Code Playgroud)
我错过了什么吗?
Abh*_*pta 11
有两件事需要做:
access_type=offline查询参数传递给oauth start请求.这将确保您在第一次为该帐户执行oauth时获得刷新令牌.prompt=consent查询参数传递给oauth start请求.参考:https://developers.google.com/identity/protocols/OAuth2WebServer#offline
| 归档时间: |
|
| 查看次数: |
2764 次 |
| 最近记录: |