7 PERMISSION_DENIED: User doesn't have permission to access customer

41 views
Skip to first unread message

Grzegorz Cieślik

unread,
Dec 16, 2019, 3:25:55 AM12/16/19
to AdWords API and Google Ads API Forum
Hi,
I use this lib ( https://github.com/Opteo/google-ads-api) for connect googleAds
with my service in node.js. I try connect to my account, but i have this error message.

Error: User doesn't have permission to access customer. Note: If you're accessing a client customer, the manager's customer id must be set in the 'login-customer-id' header. See https://developers.google.com/google-ads/api/docs/concepts/call-structure#login-customer-id
    at CustomerClientLinkService.<anonymous> (/home/gcieslik/workspace/export-creator-worker/node_modules/google-ads-api/build/services/service.js:178:23)
    at Generator.throw (<anonymous>)
    at rejected (/home/gcieslik/workspace/export-creator-worker/node_modules/google-ads-api/build/services/service.js:6:65)
  code: { authorizationError: 2 },

My code here
authorize() {
        const client = new GoogleAdsApi({
            client_id: this.clientId,
            client_secret: this.clientSecret,
            developer_token: this.developerToken
        });

        this.customer = client.Customer({
            customer_account_id: this.customerAccountId,
            login_customer_id: this.loginCustomerId,
            refresh_token: this.refreshToken
        });
    }
Message has been deleted

Grzegorz Cieślik

unread,
Dec 16, 2019, 3:30:01 AM12/16/19
to AdWords API and Google Ads API Forum
Do you have any idea how can i fix it?

Google Ads API Forum Advisor Prod

unread,
Dec 16, 2019, 12:10:30 PM12/16/19
to adwor...@googlegroups.com

Hello,

Thank you for writing to us. If you are requesting OAuth credentials from a manager account and accessing a related customer account, you will need to set the login-customer-id header to the customer ID of the manager account, removing any hyphens in the Id and customer id in the request code. Could you please confirm if you are using the credentials associated with the login customer id to make API call? If yes, could you please share the email address used while generating Oauth credentials and the client customer id against which you are trying to make the API call for me to investigate this further on my end?

P.S. Please use Reply privately to author option while sharing the details for investigation.

Regards,
Nikisha Patel, Google Ads API Team



ref:_00D1U1174p._5001UOEc2P:ref
Reply all
Reply to author
Forward
0 new messages