So I already made a complete authorization on my site using Google auth.
But I need now to add a modal window with a Terms of usage. So I made it
the next way:
after the clicking on the agree button, we are going to the script:
$params = array(
'client_id' =>
'105310604278-2m6vk8ih6g5hcjnkaaff65eo0kaop1v5.apps.googleusercontent.com',
'client_secret' => '6AQdBh2e0mcrSjG2u263-TkR',
'redirect_uri' =>
'https://s3.dev.ranepa.ru/_scripts/login_google.php',
'grant_type' => 'authorization_code',
'code' => $_GET['code']
);
$code_to_auth = $_GET['code'];
print_r($code_to_auth);
$ch = curl_init('https://accounts.google.com/o/oauth2/token');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HEADER, false);
$data = curl_exec($ch);
curl_close($ch);
$data = json_decode($data, true);
print_r($data);
I got an error , but the same code is working well for the login without
the modal window. Maybe there are some parameters I forgot about? So I
already choose my google account and I just used
document.location.href
to define get parameters for the ajax which is going to the php script
mentioned above.
[error] => invalid_grant [error_description] => Bad Request
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/e8a22941-599c-42f2-af5d-cd2469512a1en%40googlegroups.com.