ACCESS_TOKEN_SCOPE_INSUFFICIENT problem

2,314 views
Skip to first unread message

PHP programmer

unread,
Jan 17, 2024, 6:23:20 AM1/17/24
to Google Ads API and AdWords API Forum
Hi. I need to make integration between my app and Google Ads Api in particular with Generate Historical Metrics but I have the error like on the screen. In my opinion connection is correctlly becouse if I change some data, Error message will change. I created new application in my google account but my friend add me access to google ads (I have acces to developer_token, etc), but google ads is in other account. My scopes liiks like on the screen. My app was not publish. On this time I need to only testing that. Could you help me? I'm using this code https://developers.google.com/google-ads/api/docs/keyword-planning/generate-historical-metrics?hl=pl
Clipboard - 17 stycznia 2024 11_11.png
Clipboard - 17 stycznia 2024 12_02.png

Google Ads API Forum Advisor

unread,
Jan 17, 2024, 6:57:20 AM1/17/24
to michal.pr...@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for reaching out to the Google Ads API support team.

By reviewing your query, I understand that you are getting the error "PERMISSION_DENIED". It means a user doesn't have permission to access a customer and you’re accessing a client customer using 'login-customer-id’ in the request. To address the above error, you will need to ensure that the user / email address you used to generate the credentials indeed has access to the account in your request. If the user / email address has access or is associated with the MCC / manager account, you will need to specify the said MCC / manager account ID as the value of the login-customer-id field.

However, If you are still facing the issue, please provide us with the (request and response with request-id and request header) and uncropped UI screenshots to further investigate this issue.

If you are using a client library and haven't enabled the logging yet, I would request you to enable logging for the specific client library that you are using. You can refer to the guide PHP to enable logging at your end. For REST interface requests, you can enable logging via the curl command by using the -i flag.
 
This message is in relation to case "ref:!00D1U01174p.!5004Q02rX3Ul:ref"

Thanks,
 
Google Logo Google Ads API Team


PHP programmer

unread,
Jan 17, 2024, 7:20:02 AM1/17/24
to Google Ads API and AdWords API Forum
Thank you of answer. Propably problem is that I don't send login-id but I have a manager permission. But where can I found login-customer-id? I'm using this code. It's correct? On documentation I saw that this id I can find after click help icon. But i don't have id with this place.
 screen.png
I'm using this library googleads/google-ads-php:21.1.0 in Laravel framework

Google Ads API Forum Advisor

unread,
Jan 17, 2024, 8:53:30 AM1/17/24
to michal.pr...@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for getting back to us.

Please note that, login-customer-id is the customer ID of the authorized customer to use in the request, without hyphens (-). If your access to the customer account is through a manager account, this header is required and must be set to the customer ID of the manager account.

Setting the login-customer-id is equivalent to choosing an account in the Google Ads UI after signing in or clicking on your profile image at the top right. If you do not include this header, it defaults to the operating customer. The 'login-customer-id' for the currently selected client account is displayed in the upper right corner of the Google Ads UI screen.

PHP programmer

unread,
Jan 17, 2024, 2:06:42 PM1/17/24
to Google Ads API and AdWords API Forum
I understand. The issue is that the code I showed you in the screenshot is the same code that I pass in the runExample method. Can you check if the code is correct? In the INI file, I pass the developerToken, loginCustomerId, clientId, clientSecret, and refreshToken. However, I'm not sure if the loginCustomerId is correct because it is identical to the code I'm passing in the runExample function. Unless I need to find it elsewhere. Can you check if the code and configuration are okay?Zrzut ekranu z 2024-01-17 18-43-18.png

Google Ads API Forum Advisor

unread,
Jan 18, 2024, 1:38:22 AM1/18/24
to michal.pr...@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for getting back to us.

By reviewing your concern, I understand that you are unsure if you are passing the correct login customer ID. I would recommend you to kindly refer to this help center article "Find your Google Ads customer ID" as it describes in finding the login customer ID. In order to further check if your code is correct or not, kindly provide us with the complete API logs (request and response logs with request-id and request header) generated at your end and uncropped UI screenshot of the Google Ads account where you are facing the issue.

If you are using a client library and haven't enabled the logging yet, I would request you to enable logging for the specific client library that you are using. You can refer to the guides PHP to enable logging at your end. For REST interface requests, you can enable logging via the curl command by using the -i flag.

You can send the details via Reply privately to the author option, or direct private reply to this email.

PHP programmer

unread,
Jan 18, 2024, 2:10:28 AM1/18/24
to Google Ads API and AdWords API Forum
Hi,
I saw this article but I don't have this same view. If I click on the help icon I can see. Here this id doesn't exist
Zrzut ekranu z 2024-01-18 08-01-46.png
I tryed to run logging but any file is created. My settings
Zrzut ekranu z 2024-01-18 08-08-22.png
I use PHP 8.2

PHP programmer

unread,
Jan 19, 2024, 6:38:33 AM1/19/24
to Google Ads API and AdWords API Forum
Could you help me?

Google Ads API Forum Advisor

unread,
Jan 19, 2024, 11:24:12 AM1/19/24
to michal.pr...@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for getting back to us.
 
I would suggest you to use the ListAccessibleCustomers method in CustomerService to get the list of accounts associated with a manager account. However, it is necessary to understand which customers are returned to this type of request. You may check this documentation for more information related to getting customer ID.

If the issue still exists, kindly provide us with the complete API logs (request and response logs with request-id and request header) generated at your end and uncropped UI screenshot of the Google Ads account where you are facing the issue.

Google Ads API Forum Advisor

unread,
Jan 19, 2024, 11:33:29 AM1/19/24
to michal.pr...@gmail.com, adwor...@googlegroups.com
Hi,

Please ignore my previous response.


Thank you for getting back to us.
 
I would suggest you to use the ListAccessibleCustomers method in CustomerService to get the list of accounts associated with a manager account. However, it is necessary to understand which customers are returned to this type of request. You may check this documentation for more information related to getting customer ID.

If the issue still exists, kindly provide us with the complete API logs (request and response logs with request-id and request header) generated at your end and uncropped UI screenshot of the Google Ads account where you are facing the issue.

If you are using a client library and haven't enabled the logging yet, I would request you to enable logging for the specific client library that you are using. You can refer to the guides PHP to enable logging at your end. For REST interface requests, you can enable logging via the curl command by using the -i flag.

You can send the details via Reply privately to the author option, or direct private reply to this email.
 

PHP programmer

unread,
Jan 22, 2024, 7:26:28 AM1/22/24
to Google Ads API and AdWords API Forum
Hi,
so what I need to do?

Google Ads API Forum Advisor

unread,
Jan 22, 2024, 10:38:34 AM1/22/24
to michal.pr...@gmail.com, adwor...@googlegroups.com
Hi,


Thank you for getting back to us.
 
Kindly execute the ListAccessibleCustomers method in CustomerService and provide us with complete API request and response logs, you may also check this API documentation for more information. And the user email used for authenticating the API query. Also, I would suggest you send the logs as an attachment to this email thread. 

PHP programmer

unread,
Jan 22, 2024, 3:11:01 PM1/22/24
to Google Ads API and AdWords API Forum
Hi,
In my previous messages I wrote "I tryed to run logging but any file is created. My settings" and I show the printscreen of my code.

Google Ads API Forum Advisor

unread,
Jan 22, 2024, 6:32:02 PM1/22/24
to michal.pr...@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for getting back to us.

As previously requested, could you please provide us with the latest complete API logs (request and response with request-id and request header) and uncropped UI screenshots to further investigate this issue. 

If you are using a client library and haven't enabled the logging yet, I would request you to enable logging for the specific client library that you are using. You can refer to the guides Java, .Net, PHP, Python, Ruby or Perl to enable logging at your end. For REST interface requests, you can enable logging via the curl command by using the -i flag.

PHP programmer

unread,
Jan 23, 2024, 2:13:31 AM1/23/24
to Google Ads API and AdWords API Forum
Hi,
1. I wrote you that I tryed enable logging but log file doesn't created. I whow you my code
Zrzut ekranu z 2024-01-18 08-08-22.png
2. I asked you where can I find  login customer id becouse I have other view in the documentation. After I click question mark I can see that
Zrzut ekranu z 2024-01-18 08-01-46.png

Google Ads API Forum Advisor

unread,
Jan 23, 2024, 3:15:30 AM1/23/24
to michal.pr...@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for getting back to us.

In order to investigate your further, could you please confirm if you have recreated the OAuth credentials. It appears that you have not done it, so I would request you to recreate the OAuth credentials and try making the API request. 

Since you are using PHP client library, please refer to this link on how to use logging and at the DEBUG level. We would require logs to further assist you and I would request you to provide us with the complete API logs (request and response with request id and request header) after enabling the logging.

I would recommend you to kindly refer to this help center article "Find your Google Ads customer ID" .
Reply all
Reply to author
Forward
0 new messages