I am trying to get a token with the refresh_token.
I read the documentation but it doesn't work !
Here is what i do:
$data = array(
'client_id' =>
'XXXXXXXXXXXXXXXXXXX.apps.googleusercontent.com',
'client_secret' => 'XXXXXXXXXXXXXXXXXXX',
'refresh_token' => 'XXXXXXXXXXXXXXXXXXX',
'grant_type' => 'refresh_token'
);
$ch = curl_init("https://accounts.google.com/o/oauth2/token");
curl_setopt($ch,CURLOPT_POST,true);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_POSTFIELDS,$data);
$resp = curl_exec($ch);
print_r(json_decode($resp));
RESULT:
[error] => invalid_grant
I had the same problem with the precedent step (to get the refresh
token) and i solved it by add "approval_prompt=force" in the loginURL,
but i don't find any solution to refresh the token with Oauth2.
Thanks for help !
--
You received this message because you are subscribed to the Google Groups "YouTube APIs Developer Forum" group.
To post to this group, send email to youtube-api-gdata@googlegroups.com.
To unsubscribe from this group, send email to youtube-api-gdata+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/youtube-api-gdata?hl=en.
No comments:
Post a Comment