AuthorizationError.USER_PERMISSION_DENIED

62 views
Skip to first unread message

jiajia wang

unread,
Dec 24, 2020, 3:13:40 AM12/24/20
to AdWords API and Google Ads API Forum
Hi Team!

Seeing the following error in our Ruby code  

W, [2020-12-24T16:03:29.764284 #8748]  WARN -- : CID: 299562XXXX, Host: googleads.googleapis.com:443, Method: /google.ads.googleads.v6.services.GoogleAdsService/Search, IsFault: yes
I, [2020-12-24T16:03:29.764628 #8748]  INFO -- : Outgoing request: Headers: {"developer-token":"REDACTED","login-customer-id":" 299562XXXX  ","x-goog-api-client":"gl-ruby/2.5.3 gax/0.3.4 gapic/8.1.0 grpc/1.34.0","x-goog
-request-params":"customer_id= 299562XXXX    "} Payload: {"customerId":" 299562XXXX","query":"SELECT campaign.id,\n       campaign.advertising_channel_type,\n       ad_group.id,\n       ad_group.status,\n       metrics.imp
ressions,\n       metrics.hotel_average_lead_value_micros,\n       segments.hotel_check_in_day_of_week,\n       segments.hotel_length_of_stay\nFROM hotel_performance_view\nWHERE segments.date DURING LAST_7_DAYS\n  AN
D campaign.advertising_channel_type = 'HOTEL'\n  AND ad_group.status = 'ENABLED'\nORDER BY metrics.impressions DESC\nLIMIT 50\n","pageSize":1}
I, [2020-12-24T16:03:29.764726 #8748]  INFO -- : Incoming response (errors):
  Google::Ads::GoogleAds::Errors::GoogleAdsError(Google::Ads::GoogleAds::Errors::GoogleAdsError): User doesn't have permission to access customer. Note: If you're accessing a client customer, the manager's customer i
d must be set in the 'login-customer-id' header. See https://developers.google.com/google-ads/api/docs/concepts/call-structure#cid
  called from: (irb):1695:in `write_campaign_report_csv'
Error with message: 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#cid
        Type: authorization_error
        Code: USER_PERMISSION_DENIED
Traceback (most recent call last):
        2: from (irb):1716
        1: from (irb):1695:in `write_campaign_report_csv'
Google::Ads::GoogleAds::Errors::GoogleAdsError (Google::Ads::GoogleAds::Errors::GoogleAdsError)

I want access to the customer account is through a manager account
and i have set login-customer-id in client  configure

client.configure do |config|
     config.login_customer_id = customer_id.to_i
end







Google Ads API Forum Advisor Prod

unread,
Dec 28, 2020, 12:04:34 PM12/28/20
to huqif...@gmail.com, adwor...@googlegroups.com

Hi Jiajia,

Thank you for reaching out. The error USER_PERMISSION_DENIED usually occurs when there is no link between the manager account authenticated in the request and the client account specified in the headers. Please use the email that has Standard or Admin Access to the manager account to regenerate the OAuth2 credentials and make the API call again.

Thanks and regards,
Xiaoming, Google Ads API Team

Google Logo
Xiaoming
Google Ads API Team
 


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