Customer not accessible in MCC

132 views
Skip to first unread message

tkraja mdu

unread,
Aug 23, 2024, 5:31:27 AM8/23/24
to Google Ads API and AdWords API Forum
My problem is one customer linked in MCC account But using api i couldn't access that customer details

But in interface i can accessible

so, i tried this api

https://developers.google.com/google-ads/api/samples/list-accessible-customers

But, the response not return the my MCC account id, It returns some other MCC account

So, How can i setup my account as accessible? pls share the points 

Google Ads API Forum Advisor

unread,
Aug 23, 2024, 7:59:40 AM8/23/24
to tkraj...@gmail.com, adwor...@googlegroups.com
Hi,

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

Kindly note that you can check which accounts are directly linked to your manager account, You can get the account hierarchy of your manager account, you can use the following query in order to retrieve the all the child accounts specified by the client_customer field from CustomerClient
SELECT customer_client.id, customer_client.descriptive_name FROM customer_client
You can try making a request using the Search or SearchStream. Also, you can use Query Builder to create your query and Query Validator to validate your query.
 
This message is in relation to case "ref:!00D1U01174p.!5004Q02vFHM5:ref" (ADR-00264631)

Thanks,
 
Google Logo Google Ads API Team


tkraja mdu

unread,
Aug 23, 2024, 8:30:08 AM8/23/24
to Google Ads API and AdWords API Forum
Hi,

Thanks for your reply,

In this case i can see that account but when i try to fetch the products from account it return below response

Fatal error: Uncaught GuzzleHttp\Exception\ClientException: Client error: `POST https://oauth2.googleapis.com/token` resulted in a `400 Bad Request` response: { "error": "invalid_grant", "error_description": "Bad Request" } 

could you please help us to fix?

Google Ads API Forum Advisor

unread,
Aug 23, 2024, 1:50:22 PM8/23/24
to tkraj...@gmail.com, adwor...@googlegroups.com
Hi,

Based on the provided information, we noticed that you're encountering an "invalid_grant " error. According to the Google Ads API documentation, Google Cloud Platform project with an OAuth consent screen configured for an external user type and a publishing status of "Testing" is issued a refresh token expiring in 7 days. Your Google project's publishing status is Testing so the refresh token expires every 7 days and receives an invalid_grant error.

You can follow the following steps to avoid this issue:

  • Go to the Google API Console and navigate to the OAuth consent screen
  • Change the publishing status to “In production”

Also, note that the invalid_grant error usually indicates an issue with the refresh token. That said, you’ll need to regenerate credentials and refresh tokens. Alternatively, you may use the OAuth Playground to generate refresh and access tokens. Once you have a valid refresh token, the error should disappear.

Hope this clarifies. 

tkraja mdu

unread,
Aug 28, 2024, 2:04:42 AM8/28/24
to Google Ads API and AdWords API Forum
Thanks for your reply

I tried with new project credentials in API but the response 

Google Ads failure details: authorization_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

How to give permission for access the customer account?

Google Ads API Forum Advisor

unread,
Aug 28, 2024, 2:22:07 AM8/28/24
to tkraj...@gmail.com, adwor...@googlegroups.com
Hi,

I understand that you've encountered the "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" error. This means the USER_PERMISSION_DENIED error . This error occurs when the user doesn't have permission to access the customer. According to the documentation, if you're accessing the customer please specify the login-customer-id as the manager account ID without hyphens (-). Client libraries have built in support for this. Also, you may refer to the Call structure document for more information.

Also, could you please check once again if you've either an admin or standard access level to make changes to the advertiser's account. Also, I would request you to kindly provide the email address which you are trying to authenticate.

If the issue still persists even after following the above suggestion, please share with us the updated latest complete API logs (request and response with request-id and request header) generated at your end.

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.NetPHPPythonRuby 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.

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

tkraja mdu

unread,
Aug 28, 2024, 5:41:52 AM8/28/24
to Google Ads API and AdWords API Forum
Thanks for your reply

$session = (new GoogleAdsClientBuilder())
->fromFile()
->withOAuth2Credential($oAuth2Credential)
->withLoginCustomerId(1111111)
->build();

when i pass logincustomerid value in api, It return same response

Google Ads API Forum Advisor

unread,
Aug 28, 2024, 10:15:38 AM8/28/24
to tkraj...@gmail.com, adwor...@googlegroups.com
Hi, 

Kindly note that you haven't shared the complete API logs (request and response with request-id and request header) generated at your end. Also, note that you haven't shared the customer ID and the login customer ID. As requested earlier, we also need the email id from which you are trying to generate the OAuth credentials i.e, refresh token. Make sure that this email address should be present in your Google Ads account with Admin or Standard access. Navigate your Google Ads account > Admin > Access and Security > Users > The email ID with admin or standard access. I would recommend you to refer to this help center article 'Manage access to your Google Ads account' as it contains the detailed information on how to add the email ID to your account and grant access. 
Reply all
Reply to author
Forward
0 new messages