2017-05-25 95 views
-2

可以请你告诉我,执行这个之后我也没有得到适当的回应。任何人可以帮助这些盒刷新令牌脚本?

我的脚本

$cmd="curl https://api.box.com/oauth2/token \ -d 'grant_type=refresh_token&refresh_token=uuuuuuuuu&client_id=uuuuuuu&client_secret=uuuuuuu' \ -X POST"; exec($cmd,$result); 

响应

Array ([0] => {"error":"invalid_request","error_description":"Invalid grant_type parameter or parameter missing"}) 

回答

0

根据这一answer的box.net文件缺少的,对OAuth的请求Content-Type必须application/x-www-form-urlencoded的信息。

因此,请在您的cURL请求结束时尝试添加-H "Content-Type:application/x-www-form-urlencoded"

cURL文档指出parameter -d已经设置了Content-Type: application/x-www-form-urlencoded。但根据我在堆栈溢出(hereherehere)上找到的其他答案,尝试手动设置Content-Type可能会特别有助于box.net OAuth API。

相关问题