googleads / googleads/googleads-dotnet-lib
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"'.
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 108
- Forks
- 198
- PR merge metrics
- No merged PRs in 30d
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the OAuth token flow and the CustomerService.getCustomers() call shown in the issue. Compare the server token and authentication details for users who succeed and fail, then verify that the request succeeds for the affected accounts without the unauthorized exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api, authentication
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100