相关疑难解决方法(0)

获取刷新令牌google api

我无法使用我的代码获取刷新令牌.我只能获得我的访问令牌,令牌类型等,我已经按照一些教程,比如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>";
Run Code Online (Sandbox Code Playgroud)

以及我获取访问令牌的字段:

$fields=array(
    'code'=>  urlencode($authcode),
    'client_id'=> urlencode($clientid),
    'client_secret'=> urlencode($clientsecret),
    'redirect_uri'=> urlencode($redirecturi),
    'grant_type'=> 'authorization_code',
);
Run Code Online (Sandbox Code Playgroud)

但是我无法获得refresh_token,只有access_token,token_type,id_tokenexpires_in.

google-calendar-api token gdata access-token

72
推荐指数
7
解决办法
12万
查看次数

标签 统计

access-token ×1

gdata ×1

google-calendar-api ×1

token ×1