我在php中使用以下代码来撤回访问令牌:
$url ="https://accounts.google.com/o/oauth2/token";
$fields = array(
"client_id"=>"{your client id}",
"client_secret"=>"{your client secret}",
"refresh_token"=>"{your refresh token 1/.....}",
"grant_type"=>"refresh_token"
);
$ch = curl_init($url);
//set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_POST,count($fields));
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
//execute post
$lResponse_json = curl_exec($ch);
//close connection
curl_close($ch);
问题是我收到了以下错误:
“错误”:"invalid_client","error_description“:”找不到OAuth客户端。“
我已经尝试过去认证应用程序等等,但还是没有效果。有人能帮忙吗?
发布于 2015-05-13 23:59:06
问题是我没有附上client_id等.在数组中的“”中。Curl没有正确发送请求。
https://stackoverflow.com/questions/30213781
复制相似问题