create new GAW or GA credentials
08 Nov 2016steps to get new GAW or GA credentials.
create (or get) OAuth 2.0 credentials in Google API Console
- select project in top left menu (say,
adwords-api
) Credentials
(left sidebar) →Credentials
→Credentials
(tab)
here you can find OAuth 2.0 client ID and client secret.
get developer token in Google AdWords
we have only one developer token (obtained for manager account) for all our projects (including umka).
- select manager account (top-level account that manages nested accounts)
gear
icon (top right menu) →Account settings
→AdWords API Center
(left sidebar)
here you can find developer token.
generate access and refresh tokens
- save setup_oauth2.rb ruby script anywhere in filesystem
-
create adwords_api.yml file in home directory (this is where script above searches this file) with the following contents:
:authentication: :method: OAuth2 :oauth2_client_id: <client_id> :oauth2_client_secret: <client_secret> :developer_token: <developer_token> :client_customer_id: <customer_id>
<customer_id>
(in the form111-222-3333
) is either manager account ID or ID of any other account that can manage clients.from my experience generated access and refresh tokens can be used in conjunction with both specified account and its parent (manager) account. but tokens generated for manager account (
Центр клиентов I*
) couldn’t be used for subordinate manager account (re***
) when trying to find the latter usingManagedCustomerService
(that is I usedre***
account ID as master_api_key and tokens generated for manager account, tried to findre***
account using aforementioned service and gotAuthenticationError.CUSTOMER_NOT_FOUND
error) - all other API services worked as expected (magic!). -
run
ruby setup_oauth2.rb
and follow on-screen instructionsas a result of executing this script new adwords_api.yml will be generated with access and refresh tokens populated.