0
votes

I would like call google ads API with django application and I am unable to find refresh_token

I am using below code

credentials = { 'developer_token': 'xxxx', 'refresh_token': '', 'client_id': 'xxx.apps.googleusercontent.com', 'client_secret': 'xxx'}

adwords_client = GoogleAdsClient.load_from_dict(credentials)

And getting below code in django

('invalid_request: Missing required parameter: refresh_token', '{\n "error": "invalid_request",\n "error_description": "Missing required parameter: refresh_token"\n}')

1

1 Answers

0
votes

You need to run the initial authentication script provided by Google first. You can get it here.

Download that and run it from the command line and it will open a browser window for you displaying a code. Copy the code and paste it back into the command line. Google will then do the dance and provide you with a refresh token on the command line. Copy and paste this into your google_ads.yaml file. It doesn't expire, so it only needs to be done once.