<type>AuthenticationError.NOT_ADS_USER</type>

72 views
Skip to first unread message

radley...@kellybrady.com

unread,
Apr 29, 2016, 9:05:55 AM4/29/16
to AdWords API Forum
I keep getting this error
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><reportDownloadError><ApiError><type>AuthenticationError.NOT_ADS_USER</type><trigger>&lt;null&gt;</trigger><fieldPath></fieldPath></ApiError></reportDownloadError>"

I know this error means:
Reason
NOT_ADS_USER
Summary
The login used to generate the access token is not associated with any AdWords account.
Common causes
The login information provided corresponds to a Google account that does not have AdWords enabled.

The problem is that I am able to use these same credentials in the C# sample asp.net application and get authenticated. 

Why would these credentials work in one instance but not this instance?

Here is my code:

using RestSharp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GoogleAdWordsReportPuller
{
    class FileGrabber
    {

        string reportDefinition = @"<reportDefinition xmlns=""https://adwords.google.com/api/adwords/cm/v201603"">
  <selector>
    <fields>AdGroupName</fields>
    <fields>Date</fields>
    <fields>AdGroupStatus</fields>
    <fields>CampaignName</fields>
    <fields>Impressions</fields>
    <fields>Clicks</fields>
    <fields>Conversions</fields>
    <fields>Cost</fields>
  </selector>
  <reportName>Custom Adgroup Performance Report</reportName>
  <reportType>ADGROUP_PERFORMANCE_REPORT</reportType>
  <dateRangeType>YESTERDAY</dateRangeType>
  <downloadFormat>CSV</downloadFormat>
</reportDefinition>";


        string developerToken = "xxxxxxxxxxxxx";
        string accessToken = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; // actually a refresh token


        string accountId = "585-353-4323"; // client account id



        public void GetReport()
        {

            //Host: adwords.google.com
            //User-Agent: curl, gzip
            //Accept: */*
            //Accept-Encoding: gzip
            //Authorization: Bearer [Enter OAuth 2.0 access token here]
            //developerToken: [Enter developerToken here]
            //clientCustomerId: [Enter clientCustomerID here]
            //Content-Length: 784
            //Expect: 100-continue
            //Content-Type: multipart/form-data; boundary=------------------------12d01fae60c7b559

            var client = new RestClient(clientUrl);
            var request = new RestRequest(Method.POST);

            // set http headers
            request.AddHeader("Host", "adwords.google.com");
            request.AddHeader("User-Agent", "curl, gzip");
            request.AddHeader("Accept", "*/*");
            request.AddHeader("Accept-Encoding", "gzip");
            request.AddHeader("Authorization", accessToken); // tried  request.AddHeader("Authorization", "Bearer " + accessToken); 
            request.AddHeader("developerToken", developerToken);
            request.AddHeader("clientCustomerId", accountId);
            request.AddHeader("Content-Length", "784");
            //request.AddHeader("Expect", "100-continue");
            request.AddHeader("Content-Type", "multipart/form-data; boundary=------------------------12d01fae60c7b559");

            //set request parameters
            request.AddParameter("__rdxml", reportDefinition); // adds to POST or URL querystring based on Method

            // execute the request
            IRestResponse response = client.Execute(request);
            var content = response.Content; // raw content as string

        }

    }
}



I'm wondering if I need an access token instead because according to the documentation: https://developers.google.com/adwords/api/docs/guides/reporting#complete-example
The http header has a field that says: 

POST /api/adwords/reportdownload/v201601 HTTP/1.1
Host: adwords.google.com
User-Agent: curl, gzip
Accept: */*
Accept-Encoding: gzip
Authorization: Bearer [Enter OAuth 2.0 access token here]
developerToken: [Enter developerToken here]
clientCustomerId: [Enter clientCustomerID here]
Content-Length: 784
Expect: 100-continue
Content-Type: multipart/form-data; boundary=------------------------12d01fae60c7b559

Can anyone help me?

Thanks


Josh Radcliff (AdWords API Team)

unread,
Apr 29, 2016, 3:01:14 PM4/29/16
to AdWords API Forum
Hi,

Could you elaborate on why you are not using the reporting utility in the .NET client library, as shown in the DownloadCriteriaReport example? That will handle setting all of the necessary headers, etc. All you have to do is configure your App.config file as specified in the App.config sample in the library, and the library will take care of exchanging your refresh token for an access token, as well as properly setting up the HTTP request for reports.

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