Access token with client library of gRPC

56 views
Skip to first unread message

Hiroki Nohara

unread,
May 25, 2021, 3:35:16 AM5/25/21
to AdWords API and Google Ads API Forum
Hello,
In usual case of OAuth2 flow, access token is used for each request.
Does python client library "google-ads" get access token for each request using refresh token?
And does the library send requests in addition to the main request (fetching resource data) as like fetching access token every call of GoogleAdsService.SearchStream()?

Google Ads API Forum Advisor Prod

unread,
May 25, 2021, 9:11:19 AM5/25/21
to noh...@richka.co.jp, adwor...@googlegroups.com

Hi Hiroki,

Thank you for reaching out. The access token has a lifetime of 1 hour. Once it’s expired the client library would automatically generate the access token to be able to successfully issue the API call. Thus, the access token is not generated on the per API request basis but rather depends on whether it has expired.

Thanks and regards,
Xiaoming, Google Ads API Team
 


Google Logo
Xiaoming
Google Ads API Team
 


ref:_00D1U1174p._5004Q2HDRbu:ref

Hiroki Nohara

unread,
May 25, 2021, 10:03:13 PM5/25/21
to AdWords API and Google Ads API Forum

Hi Xiaoming,
Thank you for following up.

To make the access token reused during the lifetime, should I reuse one `GoogleAdsClient` object?
Or is the lifetime dealt per "client library and correspond refresh token" set?

I would like to know the way in which access token is re-generated less time as possible.


2021年5月25日火曜日 22:11:19 UTC+9 adsapiforumadvisor:

Google Ads API Forum Advisor Prod

unread,
May 26, 2021, 11:04:55 AM5/26/21
to noh...@richka.co.jp, adwor...@googlegroups.com

Hi Hiroki,

Thank you for reaching out. The access token is not generated for each `GoogleAdsClient` instance but rather on the account level to create sessions. Thus, you could feel free to recreate the `GoogleAdsClient` instances as many times as you want.



Thanks and regards,
Xiaoming, Google Ads API Team
 

Reply all
Reply to author
Forward
0 new messages