What I want to know is how to fill out the yml config. Mine sanitized looks something like (I am using some from the live account and some from the test account and hitting auth errors using the api):
---
# This is an example configuration file for the AdWords API client library.
# Please fill in the required fields, and copy it over to your home directory.
:authentication:
# Authentication method, methods currently supported:
# OAUTH2, OAUTH2_SERVICE_ACCOUNT.
:method: OAUTH2_SERVICE_ACCOUNT
# Auth parameters for OAUTH2 method.
# Set the OAuth2 client id and secret. Register your application here to
# obtain these values:
# https://console.developers.google.com/
:oauth2_client_id: [PRODUCTION-account]
:oauth2_client_secret: [PRODUCTION-account-secret]
# Optional, see: https://developers.google.com/accounts/docs/OAuth2WebServer
#:oauth2_callback: INSERT_OAUTH2_CALLBACK_URL_HERE
#:oauth2_state: INSERT_OAUTH2_STATE_HERE
#:oauth2_access_type: INSERT_OAUTH2_ACCESS_TYPE_HERE
#:oauth2_approval_prompt: INSERT_OAUTH2_APPROVAL_PROMPT_HERE
# You can define extra scopes so that you can reuse your refresh token for
# other APIs.
#:oauth2_extra_scopes: [INSERT_EXTRA_SCOPES_HERE]
# Auth parameters for OAUTH2_SERVICE_ACCOUNT method. See:
# https://developers.google.com/accounts/docs/OAuth2ServiceAccount
:oauth2_issuer: [ID-FROM-DEVELOPER-CONSOLE]
:oauth2_secret: notasecret
:oauth2_keyfile: [location of file]
# To impersonate a user set prn to an email address.
:oauth2_prn: [PRODUCTIO...@myaddress.com]
# Other parameters.
:developer_token: [developer-token-from-PRODUCTION-account]
:client_customer_id: [TEST-account-client-id]
:user_agent: INSERT_YOUR_USER_AGENT_HERE
:service:
# Only production environment is available now, see: http://goo.gl/Plu3o
:environment: PRODUCTION
:connection:
# Enable to request all responses to be compressed.
:enable_gzip: false
# If your proxy connection requires authentication, make sure to include it in
# the URL, e.g.: http://user:password@proxy_hostname:8080
# :proxy: INSERT_PROXY_HERE
:library:
# Optional: set the log level.
:log_level: INFO
# Optional: uncomment to skip header / summary rows in reporting.
#:skip_report_header: true
#:skip_report_summary: true
#:skip_column_header: true
# Optional: uncomment to disable user agent showing used utilities.
#:include_utilities_in_user_agent: false
:oauth2_client_id: [TEST-account]
:oauth2_client_secret: [TEST-account-secret]
:client_customer_id: [TEST-account-client-id]
I tried this suggestion but did not get any further.
---:authentication:
:method: OAUTH2_SERVICE_ACCOUNT
:oauth2_client_id: [TEST]
:oauth2_client_secret: [TEST]
:oauth2_issuer: [PRODUCTION]
:oauth2_secret: notasecret
:oauth2_keyfile: [PRODUCTION-path]
:oauth2_prn: [PRODUCTION]
:developer_token: [PRODUCTION]
:client_customer_id: [TEST]
:user_agent: INSERT_YOUR_USER_AGENT_HERE
:service:
:environment: PRODUCTION
:connection:
:enable_gzip: false
:library:
:log_level: INFORESULTED IN:[AuthorizationError.USER_PERMISSION_DENIED @ ; trigger:'<null>']
So, I also tried the following but still got an error.
---
:authentication:
:method: OAUTH2_SERVICE_ACCOUNT
:oauth2_client_id: [TEST]
:oauth2_client_secret: [TEST]
:oauth2_issuer: [TEST]
:oauth2_secret: notasecret
:oauth2_keyfile: [TEST-path]
:oauth2_prn: [TEST]
:developer_token: [PRODUCTION]
:client_customer_id: [TEST]
:user_agent: INSERT_YOUR_USER_AGENT_HERE
:service:
:environment: PRODUCTION
:connection:
:enable_gzip: false
:library:
:log_level: INFO
RESULTED IN:Authorization failed. Server message: { "error" : "unauthorized_client", "error_description" : "Unauthorized client or scope in request." }
It's really unclear to me which values I should be using for each field from the 2 different test/production accounts.
I also don't understand from a security perspective how the accounts should be linked in their respective configs.
Thanks for your patients and help resolving this with me.Ed