1

Im using the following code in php to retreive the access token:

  $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);

The problem is im receiving the following error:

"error" : "invalid_client", "error_description" : "The OAuth client was not found."

I have tried de-authenticating the app etc still to no avail. Can anyone help?

abraham
  • 46,583
  • 10
  • 100
  • 152
tommo
  • 1,350
  • 1
  • 10
  • 25
  • Have you checked you are entering the correct client id? I think you mean retrieve the access token. You already have a refresh token what you need is a new access token. – Linda Lawton - DaImTo May 13 '15 at 13:00
  • the client id is correct, this retreives the access token. im following the answer from here: http://stackoverflow.com/questions/12427479/am-i-getting-the-steps-right-for-verifying-a-users-android-in-app-subscription – tommo May 13 '15 at 13:17

1 Answers1

0

The problem was that i was not enclosing the client_id etc... within " " in the array. Curl was not sending the request properly.

tommo
  • 1,350
  • 1
  • 10
  • 25