Rest API refresh token. revoked in 1 hour

621 views
Skip to first unread message

Duvan Felipe Buritica Cardona

unread,
Oct 27, 2022, 9:00:25 PM10/27/22
to Google Ads API and AdWords API Forum
Hi.

I have a app of google ads api verified. but I have a problem.

The token is revoked in 1 hour and when I try to update it through this method:
  --data "grant_type=refresh_token" \

   --data "customer_id=CUSTOMER_ID" \

   --data "client_secret=CUSTOMER_SECRET" \

   --data "refresh_token=REFRESH_TOKEN" \

   https://www.googleapis.com/oauth2/v3/token

responds with the same token and with an expiration time of one hour but it expires after the time of the first token

thanks

Google Ads API Forum Advisor

unread,
Oct 28, 2022, 2:43:25 AM10/28/22
to duva...@gmail.com, adwor...@googlegroups.com

Hi there,

Thanks for reaching out to the Google Ads API Forum.

You may use our client libraries where refresh token does not expire for a long time if your OAuth app is already verified, and it does handle access token itself. Note that while using CURL, Access Tokens expire after 60 minutes which is the default value.

Regards,

Google Logo
Yasar
Google Ads API Team
 


ref:_00D1U1174p._5004Q2fp4Ks:ref

Duvan Felipe Buritica Cardona

unread,
Nov 2, 2022, 7:38:20 PM11/2/22
to Google Ads API and AdWords API Forum
Hello,

Is it possible to update the token from the library after having obtained the initial token by curl? It is a REST API that will do this process.

Google Ads API Forum Advisor

unread,
Nov 3, 2022, 12:55:13 AM11/3/22
to duva...@gmail.com, adwor...@googlegroups.com
Hi,

I am Carmela from the Google Ads API team as well. Thank you for getting back to our team.

With regard to "Is it possible to update the token from the library after having obtained the initial token by curl? It is a REST API that will do this process.", could you please provide more context on this so we can provide accurate recommendation?

Also, you may see this sample code that you can use in generating User Credentials. You may also check this video which will guide you using the REST Interface with the Google Ads API.

Regards,
Google Logo
Carmela
Google Ads API Team
 


ref:_00D1U1174p._5004Q2fp4Ks:ref

Duvan Felipe Buritica Cardona

unread,
Nov 4, 2022, 12:05:37 AM11/4/22
to ads...@forumsupport.google, adwor...@googlegroups.com
Hi, I have a question.  if my application has the front (reat with javascript) and the black (API python).  How would the flow be to obtain the token and update it.  since it was currently done using curl and only lasts an hour.

Thanks.

Google Ads API Forum Advisor

unread,
Nov 4, 2022, 4:35:12 AM11/4/22
to duva...@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for the reply.

As stated by my colleague Yasar, "you may use our client libraries where refresh tokens do not expire for a long time if your OAuth app is already verified and it does handle access tokens itself,"  and since you mentioned that your backend is Python (API Python), then I would recommend you check this documentation as it has the instructions on how to generate an OAuth2 refresh token and set up the configuration file for your client.

Best regards,
Google Logo
Heidi
Google Ads API Team
 


ref:_00D1U1174p._5004Q2fp4Ks:ref

Google Ads API Forum Advisor

unread,
Nov 14, 2022, 1:30:28 AM11/14/22
to duva...@gmail.com, adwor...@googlegroups.com
Hi Duvan,

Thank you for getting back to us.

Could you please show us where you get that example? Have you followed the guide on the link that my colleagues provided on the previous email?

Kind regards,
Google Logo
Sherwin Vincent
Google Ads API Team
 


ref:_00D1U1174p._5004Q2fp4Ks:ref

Duvan Felipe Buritica Cardona

unread,
Nov 18, 2022, 12:19:35 PM11/18/22
to Google Ads API Forum Advisor, adwor...@googlegroups.com
hello dears,

According to this example, because this request only returns the access token and not the refresh token.

https://accounts.google.com/o/oauth2/v2/auth?

 scope=https%3A//www.googleapis.com/auth/adwords&

 access_type=offline&

 include_granted_scopes=true&

 response_type=code&

 state=state&

 redirect_uri=https://app.roalytics.com/auth&

 client_id=10836400011xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx


the scope  scope=https%3A//www.googleapis.com/auth/drive.metadata.readonly&


This does return both tokens.


thanks

Reply all
Reply to author
Forward
0 new messages