Accessing access token from Ads client instance

121 views
Skip to first unread message

Po-Yu Hsieh

unread,
Aug 19, 2021, 12:18:06 PM8/19/21
to AdWords API and Google Ads API Forum
Hi, 

  I'm trying to download invoice PDF from URL retrieved by API call with the instruction below:

  Making the HTML request requires access token for Google Ads service. From how the authentication works, access token should be created fresh with other token/credentials, but I'm not sure how to make it with Google's Ruby libraries.  Is it possible to obtain/access the token through Google Ads' client instance (Google::Ads::GoogleAds::GoogleAdsClient) ?

Google Ads API Forum Advisor

unread,
Aug 19, 2021, 1:44:03 PM8/19/21
to pyk...@gmail.com, adwor...@googlegroups.com
Hi,

Please refer to the Ruby samples in the link: https://developers.google.com/google-ads/api/docs/samples/authenticate-in-desktop-application?hl=en#ruby

Let me know if you have any further questions.

Thanks,

Google Logo
Lakshmi Prathipati
Google Ads API Team
 


 

ref:_00D1U1174p._5004Q2Lod3d:ref

Po-Yu Hsieh

unread,
Aug 19, 2021, 9:03:38 PM8/19/21
to AdWords API and Google Ads API Forum
Hi,

  What about the case when I already have refresh token? I want the auth+download process be fully automated and avoid touching the browser.

adsapi 在 2021年8月20日 星期五上午1:44:03 [UTC+8] 的信中寫道:

Google Ads API Forum Advisor

unread,
Aug 23, 2021, 11:49:21 PM8/23/21
to pyk...@gmail.com, adwor...@googlegroups.com
Hi Po-Yu,

When using client libraries such as Ruby, initially, you will need to retrieve your credentials (client ID, client Secret) from the Google API Console, before you can specify them into the client library's properties file.

Since you also mentioned that you already have a refresh token, and assuming that it has already been specified as well in the properties file, the access token should then be automatically created for you each time you run the API via a client library.

Best regards,

Google Logo
Peter Laurence Napa Oliquino
Google Ads API Team
 


ref:_00D1U1174p._5004Q2Lod3d:ref
Reply all
Reply to author
Forward
0 new messages