create new GAW or GA credentials08 Nov 2016
steps 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,
Credentials(left sidebar) →
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)
gearicon (top right menu) →
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 form
111-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 using
ManagedCustomerService(that is I used
re***account ID as master_api_key and tokens generated for manager account, tried to find
re***account using aforementioned service and got
AuthenticationError.CUSTOMER_NOT_FOUNDerror) - all other API services worked as expected (magic!).
ruby setup_oauth2.rband follow on-screen instructions
as a result of executing this script new adwords_api.yml will be generated with access and refresh tokens populated.