Re: get access token - error 302
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, Peter Laurence Oliquino Google Ads API Team On Thursday, June 10, 2021 at 10:37:39 PM UTC+8 89031...@mail.ru 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 > > > > Moved Temporarily > > > Moved Temporarily > The document has moved https://accounts.google.com/signin/oauth/error?authError=Cg9pbnZh..yIJAD&client_id=332052792041-lka09bsu9g3h15em6g2jeua8v429fk95.apps.googleusercontent.com > ">here. > > > > 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 adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com 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 adwords-api+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/c378402e-8e0a-4afe-b458-641e4649ae38n%40googlegroups.com.
Re: get access token - error 302
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 89031...@mail.ru 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 > > > > Moved Temporarily > > > Moved Temporarily > The document has moved https://accounts.google.com/signin/oauth/error?authError=Cg9pbnZh..yIJAD&client_id=332052792041-lka09bsu9g3h15em6g2jeua8v429fk95.apps.googleusercontent.com > ">here. > > > > 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 adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com 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 adwords-api+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/d66d6b26-d77c-437a-b277-84aa30471fd3n%40googlegroups.com.
RE: get access token - error 302
Hi, Thank you for reaching out to our API support team. Since you mentioned you are using the REST API, you may refer to this REST interface authentication guide for the complete steps that you need to follow in order to acquire the required credentials and successfully authenticate your requests. Also, this section discusses how you can generate a new access token for use in your API calls. Best regards, Peter Laurence Napa Oliquino Google Ads API Team ref:_00D1U1174p._5004Q2Iwqi6:ref -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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 adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com 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 adwords-api+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/GGAeT0QV38BH00hN33IhE0T7aRB52zyet0QA%40sfdc.net.
RE: get access token - error 302
Hi, I also had to delete your initial post as it contained your client ID. I am reposting the rest of your post instead for reference : "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 Moved Temporarily Moved Temporarily The document has moved here. What is my mistake?" Best regards, Peter Laurence Napa Oliquino Google Ads API Team ref:_00D1U1174p._5004Q2Iwqi6:ref -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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 adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com 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 adwords-api+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/U6g7z0QV3LWV00UOddAlhjRN-aozmKqOs7Sg%40sfdc.net.