我正尝试使用OAuth.io为Google提供者获取使用令牌&刷新令牌。我已选择脱机访问OAuth.io中的access_type。使用OAuth.io JS SDK(客户端)从Google获取刷新令牌
以下是我没有收到在响应refresh_token代码
OAuth.popup("google", {'authorize' : { "approval_prompt" : 'force'}})
.done(function(result) {
console.log(result);
})
.fail(function (err) {
//handle error with err
console.log(err);
});
。我只从响应中获得access_token。访问令牌
JSON的反应是:
{
"status": "success",
"data": {
"access_token": "ya29.pAGQWe3yxxxxxx",
"token_type": "Bearer",
"expires_in": 3600,
"request": {
"url": "https://www.googleapis.com",
"headers": {
"Authorization": "Bearer {{token}}"
}
},
"id_token": "eyJhbGciOiJSUzIxxxxxxxx"
},
"state": "Q9nfocQXJxxxx",
"provider": "google"
}
参考
我发现这个链接SO Getting refresh tokens from Google with OAuth.io 在这里,他们解释了如何获得服务器端刷新令牌。
我想在客户端JS中获取刷新令牌。
你能不能从服务器到客户端通过它发送刷新令牌前端? – winhowes