我有想從提供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