User doesn't have permission to access customer...Following Tutorial

2,927 views
Skip to first unread message

nhaad...@gmail.com

unread,
Oct 30, 2017, 9:56:04 AM10/30/17
to AdWords API Forum
I am following your tutorial - Make Your First API Call - https://developers.google.com/adwords/api/docs/guides/first-api-call

  1. Created a new email/manager account and requested a developer token
  2. Created a new email/test manager account from the manager account
  3. Created a test client from the test manager - I was not prompted to create a new email for this - just a name
  4. Created test campaign/ad group/ad
  5. Created a C# client via NuGet
  6. Setup my OAuth2 authentication via Refresh token generator
  7. Execute sample application making a call to the GetCampaigns module
I receive the following error - 

This code example lists all campaigns. To add a campaign, run AddCampaign.cs.
An exception occurred while running this code example. System.Reflection.TargetInvocationException (Exception has been thrown by the target of an invocation.)

   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at AdWordsConsoleApp.Examples.CSharp.Program.InvokeRun(Object codeExample, AdWordsUser user) in \\nhafile100\user_data$\solson\Documents\Visual Studio 2017\Projects\AdWordsConsoleApp\AdWordsConsoleApp\Program.cs:line 138
   at AdWordsConsoleApp.Examples.CSharp.Program.RunACodeExample(AdWordsUser user, Object codeExample) in \\nhafile100\user_data$\solson\Documents\Visual Studio 2017\Projects\AdWordsConsoleApp\AdWordsConsoleApp\Program.cs:line 97

Caused by

System.ApplicationException (Failed to retrieve campaigns)

   at AdWordsConsoleApp.Examples.CSharp.v201710.GetCampaigns.Run(AdWordsUser user) in \\nhafile100\user_data$\solson\Documents\Visual Studio 2017\Projects\AdWordsConsoleApp\AdWordsConsoleApp\v201710\BasicOperations\GetCampaigns.cs:line 89

Caused by

Google.Api.Ads.AdWords.Lib.AdWordsApiException (AdWordsApiException: Exception of type 'Google.Api.Ads.AdWords.Lib.AdWordsApiException' was thrown.

User doesn't have permission to access customer.. (Error: AuthorizationError.USER_PERMISSION_DENIED, FieldPath: , Trigger: <null>)

)

I've looked into the error/forums and the only mention is the accounts aren't linked.  I created the test manager account from the manager account and the test client from the test manager account.  My understanding is that linking accounts is on the production side.  The test client created from the test manager doesn't even have its own email as far as I can tell.

Thanks for any help,
Steve

Bharani Cherukuri (AdWords API Team)

unread,
Oct 30, 2017, 2:11:32 PM10/30/17
to AdWords API Forum
Hello Steve, 

The USER_PERMISSION_DENIED error is experienced when there is no link between the manager account authenticated in the request and the client account specified or when the OAuth credentials used are for a user who do not have access to the client customer ID specified or any of its manager accounts. You could use CustomerService.getCustomers() which returns details of all the customers directly accessible by the user authenticating the call and then use the ManagedCustomerService to determine the client accounts linked to a manager account. 

If you continue to have an issue with this, could you provide us the SOAP request and response logs for the API call along with the email address used for authentication, so we can take a look and assist further. You can respond via Reply privately to author option while replying. 

Thanks,
Bharani, AdWords API Team
Reply all
Reply to author
Forward
0 new messages