【发布时间】:2012-02-15 01:45:42
【问题描述】:
我无法使用我的代码获取刷新令牌。我只能获取我的访问令牌、令牌类型等,
我遵循了一些教程,例如将 access_type=offline 放在我的登录 URL 上:
echo "<a href='https://accounts.google.com/o/oauth2/auth?"
. "access_type=offline&client_id=123345555.apps.googleusercontent.com& "
. "scope=https://www.googleapis.com/auth/calendar+https://www.googleapis.com/auth/plus.me&response_type=code& "
. "redirect_uri=http://www.sample.com/sample.php&state=/profile'>Google</a>";
和我获取访问令牌的字段:
$fields=array(
'code'=> urlencode($authcode),
'client_id'=> urlencode($clientid),
'client_secret'=> urlencode($clientsecret),
'redirect_uri'=> urlencode($redirecturi),
'grant_type'=> 'authorization_code',
);
但我无法获得 refresh_token,只有 access_token、token_type、id_token 和 expires_in.
【问题讨论】:
-
/*检查此链接对我有用@Nobert 解决方案 */ stackoverflow.com/questions/10827920/…
标签: google-calendar-api token access-token gdata