PERMISSION_DENIED with google ads api

211 views
Skip to first unread message

Cauz Jérôme

unread,
Apr 8, 2022, 6:20:28 AM4/8/22
to Google Ads API and AdWords API Forum
Hi,

I am having some difficulty making requests to the google ads API. I created a project with a client id and client secret I activated the google ads api, but one of the accounts gives me a PERMISSION_DENIED error.

However, I have no problem with one of the developer tokens which connects without problem with the same project. The one who poses a problem, on the other hand, manages to connect without any problem to the old adwords API. I may need to authorize the project with the developer token for the new google ads api, but if so I don't see how.

Thanks for your help,

Google Ads API Forum Advisor

unread,
Apr 8, 2022, 10:54:25 AM4/8/22
to cauz....@gmail.com, adwor...@googlegroups.com
Hi Cauz,

Thank you for reaching out to us.

To investigate the issue further, could you please provide the complete request and response logs, with the request-id?

If you haven't yet, logging can be enabled by navigating to the Client libraries > Your client library (ex. Java) > Logging documentation, which you can access from this link. You can provide it via Reply privately to author option. If this option is not available, then send it instead on this email address googleadsa...@google.com.

Thanks,
Google Logo
Nirmita
Google Ads API Team
 


ref:_00D1U1174p._5004Q2ZL4lT:ref

Cauz Jérôme

unread,
Apr 11, 2022, 5:10:36 AM4/11/22
to Google Ads API and AdWords API Forum
Hi,

Thank you for your reply.
Here is what I get:
{
    "message": "The caller does not have permission",
    "code": 7,
    "status": "PERMISSION_DENIED",
    "details": [
        {
            "@type": "google.ads.googleads.v9.errors.googleadsfailure-bin",
            "data": "<Unknown Binary Data>"
        },
        {
            "@type": "grpc-status-details-bin",
            "data": "<Unknown Binary Data>"
        },
        {
            "@type": "request-id",
            "data": "-fgJosAzjUQSb43BsJQJIw"
        }
    ]
}

The logs give exactly the same information. I still sent you on the email give what I received.

Thank you for help,

Cauz Jérôme

unread,
Apr 11, 2022, 5:14:18 AM4/11/22
to Google Ads API and AdWords API Forum
The email given is obviously not complete. Here are the logs:

CampaignController_campaignFindAction: -2951715149- {

     "message": "The caller does not have permission",
     "code": 7,
     "status": "PERMISSION_DENIED",
     "details": [
         {
             "@type": "google.ads.googleads.v9.errors.googleadsfailure-bin",
             "data": "<Unknown Binary Data>"
         },
         {
             "@type": "grpc-status-details-bin",
             "data": "<Unknown Binary Data>"
         },
         {
             "@type": "request-id",
             "data": "-fgJosAzjUQSb43BsJQJIw"
         }
     ]
} #0 /data/vendor/googleads/google-ads-php/src/Google/Ads/GoogleAds/Lib/V9/GoogleAdsExceptionTrait.php(50): class@anonymous->createGoogleAdsException()
#1 /data/vendor/googleads/google-ads-php/src/Google/Ads/GoogleAds/Lib/V9/ServerStreamingGoogleAdsExceptionMiddleware.php(96): class@anonymous->throwGoogleAdsException()
#2 /data/vendor/googleads/google-ads-php/src/Google/Ads/GoogleAds/Lib/V9/ServerStreamingGoogleAdsResponseMetadataCallable.php(63): class@anonymous->readAll()
#3 /data/vendor/googleads/google-ads-php/src/Google/Ads/GoogleAds/Lib/V9/GoogleAdsServerStreamDecorator.php(73): class@anonymous->readAll()
#4 /vagrant/app/Controllers/CampaignController.php(154): Google\Ads\GoogleAds\Lib\V9\GoogleAdsServerStreamDecorator->iterateAllElements()
#5 [internal function]: App\Controllers\CampaignController->campaignFindAction()
#6 /vagrant/app/micro-bootstrap.php(51): Phalcon\Mvc\Micro->handle()
#7 /vagrant/public/index.php(8): require_once('/vagrant/app/mi...')
#8 {main}

Cauz Jérôme

unread,
Apr 11, 2022, 6:19:29 AM4/11/22
to Google Ads API and AdWords API Forum
I think the problem comes directly from google, because I created a new "OAuth 2.0 credential clients" and I have the exact same problem while I validated the management for adwords and ads. I know how to make requests to the adwords api but not to google ads or I have the same answer.

Google Ads API Forum Advisor

unread,
Apr 11, 2022, 3:38:40 PM4/11/22
to cauz....@gmail.com, adwor...@googlegroups.com
Hi Cauz,

Thank you for providing information.

With regards to your concern, you’ve encountered ‘USER_PERMISSION_DENIED' error. The ‘USER_PERMISSION_DENIED’ usually occurs due to incorrectly setting the 'login-customer-id’ in the request or not specifying login-customer-id in the request. Note that when a user doesn't have permission to access a customer and you’re accessing a client customer then the manager's customer ID must be set in the 'login-customer-id’ in the header request. To resolve this, you will need to ensure that your OAuth2 credentials were generated while logged in as the user / email address that has access to the customer ID in your request. Also, if the said user / email address is one that has access to the MCC / manager of the customer account, then you may specify the MCC / manager account's ID as the login-customer-id. Let me know if you have any question.

Cauz Jérôme

unread,
Apr 12, 2022, 3:13:11 AM4/12/22
to Google Ads API and AdWords API Forum
Hi,

Thanks for the details. Unfortunately, I don't think that's the problem, because I used the google id of the main account for the login-customer-id and that of the customer directly, but it doesn't work. Also, I generated the refresh token through my account which was added as admin for the main ads account and the main account, but neither of them work. I work the same way as for the ads account, which works correctly. I use the google id of the MCC account in login-customer-id which has rights to the ads client account.

I also specify that with access that does not work for the google ads API. I have no problem for google adwords api and I provide MCC account google id as login-customer-id.

Thank you,

Google Ads API Forum Advisor

unread,
Apr 12, 2022, 5:31:00 AM4/12/22
to cauz....@gmail.com, adwor...@googlegroups.com
Hi Cauz,

Thank you for the reply.

Upon seeing your provided logs, I noticed that this is not enough. I can see that you provided some but not completed. That said, could you please privately provide the complete API logs (request and response logs with request ID ) so our team can identify the exact error and provide possible recommendations?

For you to provide the requested information that generated on your end, note that this can be requested or provided to the developer handling the Google Ads API transactions when logging of the API requests has been enabled. If it hasn't been enabled yet, logging can be enabled by navigating to the Client libraries > Your client library> Logging documentation, which you can access from this link .

You may then send the requested information via the Reply privately to author option. If this option is not available, you may send the details directly to our googleadsa...@google.com alias instead.

Best regards,
Google Logo
Heidi
Google Ads API Team
 


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