Google Ads oauth2l fetching a refresh token reports missing 'type' field in credentials
I am following Google Ads documentation to fetch a refresh token. I have got to this step: https://developers.google.com/google-ads/api/docs/get-started/make-first-call#fetch_a_refresh_token
oauth2l fetch --credentials credentials.json --scope adwords \ --output_format refresh_token
When I run the above command I get the error missing 'type' field in credentials
I found answers similar to this: https://github.com/GeneralElectric/GABeat/issues/2
So I tried adding "type": "service_account"
to the json file but then I get this error instead: "private key should be a PEM or plain PKCS1 or PKCS8; parse error: asn1: syntax error: sequence truncated"
Below is the credentials.json
file (after I added the "type" field). The original was downloaded during this step of the Google Ads documentation: https://developers.google.com/google-ads/api/docs/get-started/oauth-cloud-project#id-secret
{ "type": "service_account", "web": { "client_id": "XXXXXXXXXX.apps.googleusercontent.com", "project_id": "XXXXXXXXXX", "auth_uri": "https://accounts.google.com/o/oauth2/auth", "token_uri": "https://oauth2.googleapis.com/token", "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "client_secret": "XXXXXXXXXX", "javascript_origins": [ "https://XXXXXXXXXX.co.uk" ] } }