Automating Google Ads API Refresh Token Generation and Renewal

55 views
Skip to first unread message

Disha Sood

unread,
Nov 30, 2023, 9:12:51 PM11/30/23
to Google Ads API and AdWords API Forum

I'm using the Google Ads API to retrieve information from Google Ads campaigns. Initially, I manually generated a new refresh token by following specific steps to obtain an authorization code using a designated Google ID. Subsequently, I sent a CURL request with that code to generate a refresh token. Now, I aim to automate the entire process to convert the script, responsible for fetching Google Ads campaign data, into a full-time scheduler by automating the generation and renewal of the refresh token. Unfortunately, I'm encountering difficulties in achieving this. Is there a specific code or method available to accomplish the aforementioned task?

The content of this email is confidential and intended for the recipient specified in message only. It is strictly forbidden to share any part of this message with any third party, without a written consent of the sender. If you received this message by mistake, please reply to this message and follow with its deletion, so that we can ensure such a mistake does not occur in the future.
DISCLAIMER: Though, we have put efforts into ensuring that the message is error and virus-free; unfortunately, full security of the email cannot be ensured as, despite our efforts, the data included in emails could be infected, intercepted, or corrupted. Therefore, the recipient should check the email for threats with proper software, as the sender does not accept liability for any damage inflicted by viewing the content of this email.

Google Ads API Forum Advisor

unread,
Dec 1, 2023, 10:04:44 AM12/1/23
to disha...@nablasol.com, adwor...@googlegroups.com
Hi,

Thank you for reaching out to the Google Ads API support team.

By reviewing your query, I understand that your concern is regarding the refresh token. I would recommend you to refer to these steps on how to Generate tokens. You may refer to the Fetch a refresh token guide for more details. To retrive the campaign data using the Google Ads API, you may use the campaign resource. Also, you can use Query Builder to create your query and Query Validator to validate your query.

If you are facing any issue, kindly provide us with the uncropped UI screenshot of the Google Ads account and updated complete API logs (request and response with request-id and request header) generated at your end.

If you are using a client library and haven't enabled the logging yet, I would request you to enable logging for the specific client library that you are using. You can refer to the guides Java.NetPHPPythonRuby or Perl to enable logging at your end. For REST interface requests, you can enable logging via the curl command by using the -i flag.
 
This message is in relation to case "ref:!00D1U01174p.!5004Q02qW0wE:ref"

Thanks,
 
Google Logo Google Ads API Team


Reply all
Reply to author
Forward
0 new messages