【发布时间】:2015-07-03 17:30:19
【问题描述】:
我正在尝试获取刷新令牌。 我在谷歌文档中读到了它。 现在,我正在离线使用 accesstype 并且还使用approval_prompt:“force” 但我没有得到刷新令牌作为回应。 我不明白我做错了什么。
我有以下 html 代码:
<input type="submit" class="btn btn-info" value="Google" onclick="authorizeWithGoogle()" />
Javascript 代码:
var cid = 'XXXXX';
var apik = 'XXXXX';
var scopes = 'https://www.google.com/m8/feeds';
function authorizeWithGoogle() {
gapi.client.setApiKey(apik);
gapi.auth.authorize({ client_id: cid, scope: scopes, accesstype: "offline" ,approval_prompt: "force"}, handleAuthResult);
}
function handleAuthResult(authResult) {
delete authResult['g-oauth-window'];
if (authResult && !authResult.error) {
console.log(JSON.stringify(authResult));
}
}
你能帮帮我吗?
【问题讨论】:
-
看看这个,也许这可以帮助stackoverflow.com/questions/8942340/…