Reposting the last inquiry (
https://groups.google.com/g/adwords-api/c/Vd-T_wykZ3A) from the forum as it 
wasn't routed to our support queue.

Cheers,
Aryeh Baker
Google Ads API Team

On Thursday, June 10, 2021 at 10:37:39 AM UTC-4 [email protected] wrote:

> Hello 
> Please forgive me in advance for my English The Google Ads API client 
> library uses gRPC. However, my hosting provider does not give the option to 
> install gRPC. So I have to use the REST API. I am trying to get an access 
> token using the following code:
>
> $url = "https://accounts.google.com/o/oauth2/auth";;
> $arr = array(
> 'grant_type' => 'refresh_token', 
> 'refresh_token' => '***refreshtoken***', 
> 'client_id' => '***clientid***',
> 'client_secret' => '***clientsecret***',
> );
> $headers = array(
> 'Accept: application/json',
> 'Content-Type: application/json',
> );
> $post_arr=array();
> foreach ($arr as $key=>$value) {
> $post_arr[]=$key."=".$value;
> }
> $data=implode('&',$post_arr);
>
> $handle=curl_init();
> curl_setopt($handle, CURLOPT_CUSTOMREQUEST, 'POST');
> curl_setopt($handle, CURLOPT_URL, $url);
> curl_setopt($handle, CURLOPT_HTTPHEADER, $headers);
> curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, false);
> curl_setopt($handle, CURLOPT_SSL_VERIFYHOST, false);
> curl_setopt($handle, CURLOPT_POST, true);
> curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
> curl_setopt($handle, CURLOPT_POSTFIELDS, $data);
> $response=curl_exec($handle);
> $code=curl_getinfo($handle, CURLINFO_HTTP_CODE);
>
> In response I get error 302 and the following
>
> <HTML>
> <HEAD>
> <TITLE>Moved Temporarily</TITLE>
> </HEAD>
> <BODY BGCOLOR="#FFFFFF" TEXT="#000000">
> <H1>Moved Temporarily</H1>
> The document has moved <A HREF="
> https://accounts.google.com/signin/oauth/error?authError=Cg9pbnZh......yIJAD&amp;client_id=332052792041-lka09bsu9g3h15em6g2jeua8v429fk95.apps.googleusercontent.com
> ">here</A>.
> </BODY>
> </HTML>
>
> What is my mistake?
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 
"AdWords API and Google Ads 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/d66d6b26-d77c-437a-b277-84aa30471fd3n%40googlegroups.com.
  • g... 'Вячеслав Иванов' via AdWords API and Google Ads API Forum
    • ... AdWords API and Google Ads API Forum
    • ... 'Aryeh Baker' via AdWords API and Google Ads API Forum
      • ... Google Ads API Forum Advisor
        • ... Google Ads API Forum Advisor

Reply via email to