我想,當我在終端使用PHP從BOX API獲取令牌?
curl https://api.box.com/oauth2/token \
-d 'grant_type=authorization_code&code=CODE&client_id=CLIENT_ID&client_secret=secret_ID' \
-X POST # This is working.
一個以上運行它擺脫箱API下面捲曲工作訪問令牌是工作,但我試圖用PHP但同樣的事情是投以下錯誤{"error":"invalid_request","error_description":"Invalid grant_type parameter or parameter missing"}1
下面的代碼我試圖
$access_token_url = "https://api.box.com/oauth2/token";
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $access_token_url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'grant_type'=>'authorization_code',
'code'=>'code',
'client_id'=>'id',
'client_secret'=>'secret'
));
$response = curl_exec($ch);
curl_close($ch);
我不知道什麼是真正的問題。