-
Notifications
You must be signed in to change notification settings - Fork 200
Description
Hi Team,
I am trying to link to google adwords account using Oauth2 in C# .net . However, I am getting the following error,
MessageSecurityException: The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'OAuth realm="https://accounts.google.com/OAuthGetRequestToken"'. [Returned while handling POST Request]
I had a communication regarding this with the google adwords support team. They had following reply for this
It looks like the issue is specific to the client library that you're using. Could you please post your concern on the Github issue tracker so the library owners can assist you on this
Kindly suggest what can I do to resolve the exception
Please find the below details regarding the issue which will help you to find the root cause.
We are not using WCF service.We are not using Google Ads Api. We are using Google Adwords API v201809.
Please find below the steps we are following.
We are using ASP.NET MVC Web API. We have a mobile app where user clicks on Connect to google adwords. When the user clicks the button he is redirected to google sign in page and after sign in it is re directed to the back end MVC web API along with the server token. We use this server token and fetch the customer using the service.getCustomers() method of the Google AdWordsService.v201809.CustomerService.
Please find the below code we have used
Customer c = new Customer();
Selector selector = new Selector()
{
fields = new string[] { Convert.ToString(c.customerId), c.descriptiveName }
};
CustomerService service =
(CustomerService)user.GetService(AdWordsService.v201809.CustomerService);
Customer[] cst = service.getCustomers();
And according to our error logs we are getting the error on the line
Customer[] cst = service.getCustomers();
Also, this error does not occur for all the users. Suppose, out of 100 we are get this error 1 or 2 customer.
If the error was due to code, then it should have occurred for all the users. But that's not the case.
Looking forward for your response.
Thanks.
Swapnil