Authentication problems with campaigns' listing and enhanced conversions

111 views
Skip to first unread message

Federico Rota

unread,
Sep 27, 2022, 6:25:52 AM9/27/22
to Google Ads API and AdWords API Forum
Hi,
I am getting authentication errors with both GetCampaigns and  enhanced conversions  (https://github.com/googleads/google-ads-dotnet/blob/main/Google.Ads.GoogleAds/examples/Remarketing/UploadConversionEnhancement.cs).

In my .NET 6.0 app I'm trying to instatiate a GoogleAdsClient with the following config (see example code snippet below):

 GoogleAdsConfig config = new GoogleAdsConfig()
  {
    OAuth2Mode = OAuth2Flow.APPLICATION,
    OAuth2ClientId = clientId,
    OAuth2ClientSecret = clientSecret,
    DeveloperToken = developerToken,
    LoginCustomerId = "4049465539", 
    OAuth2RefreshToken = refreshToken,
    LinkedCustomerId = "4049465539"
  };

- ClientId and Client secret come from ID client OAuth 2.0 I've configured on Cloud Console.
- DeveloperToken is set to my company's developer token (set in Google Ads UI dashboard): it's a token with test account access level.
- RefreshToken is obtained from ClientId and ClientSecret programmatically based on Google's example: https://github.com/googleads/google-ads-dotnet/wiki/API-access-using-own-credentials-(desktop-application-flow)
- LoginCustomerId and LinkedCustomerId are the id associated to my account from my company (my account with that id has admin priviledges)

Even a simple campaigns' listing using  googleAdsService.SearchStream() based on Google's examples fails with:
 StatusCode="PermissionDenied", Detail="The caller does not have permission"

My code implementation is ok but I'm pretty sure it's an authentication/config setup problem.

1) How's that? What config/permission should I check? Is Desktop Oauth 2.0 Client Id supposed to be working in my cases?

Is it even possible to test this API with a developer token using our production conversions? If it's not possible, how can I create a testing environment for Enhanced Conversions before requiring a production developer token? (p.s. we don't have https://workspace.google.com/ which seems a payment service)

Thanks in advance,

Federico
 

Google Ads API Forum Advisor

unread,
Sep 27, 2022, 1:37:38 PM9/27/22
to federic...@gmail.com, adwor...@googlegroups.com

Hi Federico,

Thanks for reaching out to the Google Ads API Forum.

Kindly see below responses to your queries:



1) How's that? What config/permission should I check? Is Desktop Oauth 2.0 Client Id supposed to be working in my cases?

>. I can see that you are pulling campaign data. You may need not to add LinkedCustomerId in your config file since it is not required for the pulling campaigns. The USER_PERMISSION_DENIED error usually indicates that you are authenticating as a user that does not have access to the account (7286318246) specified in your API request.

Also, since you specified the "login-customer-id": "4049465539", you may double check if the user / email address you used to generate your OAuth2 credentials indeed has access to the said 4049465539 MCC / manager account.

To avoid 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 to the MCC / manager account, you will need to specify the said MCC / manager account's ID as the value of the login-customer-id field.

If you still persist with the error, you may provide us with the complete request, request header and response logs, with the request-id in text format along with the email address used to generate the OAuth2 credentials via reply privately to author option, so that we can continue to investigate further.

Is it even possible to test this API with a developer token using our production conversions? If it's not possible, how can I create a testing environment for Enhanced Conversions before requiring a production developer token? (p.s. we don't have https://workspace.google.com/ which seems a payment service)

 

>> Yes, it is possible to test this API with a developer token using your production conversions. You may need to use validate_only field to True, while sending API requests so this will not execute but validate the request.

Also, you may able to create a testing environment for Enhanced Conversions before requiring a production developer token but using Test account access level developer token. You may refer to this guide:https://developers.google.com/google-ads/api/docs/first-call/test-accounts

Regards,

Google Logo
Yasar
Google Ads API Team
 


ref:_00D1U1174p._5004Q2egxdV:ref

Google Ads API Forum Advisor

unread,
Sep 27, 2022, 1:39:46 PM9/27/22
to federic...@gmail.com, adwor...@googlegroups.com

Hi Federico,

Just to add, you may disregard typo account 7286318246 mentioned in above response.

Regards,

Reply all
Reply to author
Forward
0 new messages