google-ads-api
google-ads-api copied to clipboard
Service Account Authentication
Having same concern - currently stuggling to implement google api "hack" to imitate user. Since I just need Server 2 Server communication to send conversion event automatically on purchase. According to google I should get service auth which provides only accessToken instead of refresh_token.
- Need constructor of Customer (self destructive after 1 h) which would take accessToken instead of refresh_token.
It seems like a duplicate of https://github.com/Opteo/google-ads-api/issues/83
may be this info would be helpful
then client can be looks like
const auth = new Auth.GoogleAuth({
keyFile: 'key-file.json',
scopes: ['https://www.googleapis.com/auth/adwords'],
});
const client = await auth.getClient();
- next step would be specify client to send request as it shown from ofic google doc
curl -i -X POST https://googleads.googleapis.com/v19/customers/CUSTOMER_ID/googleAds:searchStream \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ACCESS_TOKEN" \
-H "developer-token: DEVELOPER_TOKEN" \
-H "login-customer-id: LOGIN_CUSTOMER_ID" \
--data-binary "@query.json"
I created a fix as I was in need of this too: https://github.com/Opteo/google-ads-api/pull/525