我有想从提供PandaDocs API的REFRESH_TOKEN的ACCESS_TOKEN一个问题..... API调用OAuth2.0的刷新令牌问题PandaDocs
什么是正确的参数,以便获得发送来自刷新令牌的新ACCESS_TOKEN?
我存储了我最初收到的刷新标记,当我第一次通过身份验证以上传要签名的文档时。我现在想要使用刷新令牌来获取新的访问令牌,以检查文档上签名的状态。
我想获得一个新的访问令牌使用我存储的刷新令牌,但我一直得到的grant_type是无效的。
这是我的代码..
$token = '(refreshtokenhere)';
$url = "https://app.pandadoc.com/oauth2/access_token";
$useragent = 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.2 (KHTML, like Gecko) Chrome/5.0.342.3 Safari/533.2';
$ch = curl_init();
$headr = array();
$headr[] = 'Content-Type: application/json;charset=UTF-8';
curl_setopt($ch, CURLOPT_HTTPHEADER,$headr);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
$postfields['grant_type'] = 'refresh_token';
$postfields['refresh_token'] = $token;
$postfields['client_id'] = CLIENT_ID;
$postfields['client_secret'] = CLIENT_SECRET;
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
echo $ret = curl_exec($ch); //
你没有提到你从哪里得到这个令牌或者是什么 – 2015-03-08 19:15:26
我有我第一次通过身份验证时保存的refresh_token。我存储它重用它.. – 2015-03-08 19:28:09
它来自PandaDocs ... – 2015-03-08 19:28:29