我无法使用我的代码获取刷新令牌。 我只能获取访问令牌、令牌类型等信息,
我已经按照一些教程进行了操作,例如在我的登录URL中添加access_type=offline
:
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。