google-ads-api icon indicating copy to clipboard operation
google-ads-api copied to clipboard

Service Account Authentication

Open wiesenthal opened this issue 1 year ago • 4 comments

Docs

Service account authentication is recommended for server-to-server access for Google Ads API.

wiesenthal avatar May 22 '24 22:05 wiesenthal

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.

Zauras avatar Jun 16 '24 10:06 Zauras

It seems like a duplicate of https://github.com/Opteo/google-ads-api/issues/83

khaldoonmasudalliance avatar Feb 11 '25 22:02 khaldoonmasudalliance

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"

yugin-pro avatar Apr 18 '25 19:04 yugin-pro

I created a fix as I was in need of this too: https://github.com/Opteo/google-ads-api/pull/525

rogiervandenberg avatar Sep 26 '25 12:09 rogiervandenberg