0

I am tearing my the remainings of my hair off trying to solve an issue with DotNetOpenOAuth. Below are the details of the problem.

Consumer = new DesktopConsumer(xeroProviderDescription, _tokenManager);
var endPoint = new MessageReceivingEndpoint(apiEndPoint, HttpDeliveryMethods.PostRequest | HttpDeliveryMethods.AuthorizationHeaderRequest);
var request = Consumer.PrepareAuthorizedRequest(endPoint, accessToken);
var content = Encoding.UTF8.GetBytes(payload);
request.ContentType = "application/json";
request.ContentLength = content.Length;

This works perfectly fine, the server accepts the request and replies. Now, I want to switch to using xml to talk to the remote service (this is their prefered format over json) So I changed all the code into sending XML data instead of json and changed the content-type to application/x-www-form-urlencoded as per the web service provider documentation. The problem now is that the service is returning 401 unauthorized request - Reason: invalid signature whenever application/x-www-form-urlencoded is used

Questions:

  1. Is the Content-Type taken into account when generating the oauth signature (I looked into the DotNetOpenOAuth source code with no luck)?
  2. Anyone has ever encountered this issue and resolved it?
GETah
  • 20,922
  • 7
  • 61
  • 103
  • Do a request dump to see if it's username/password/accesstoken issue. Reading the OAuth provider's manual will help greatly. – Nathan Apr 20 '16 at 23:50
  • Thanks for the feedback. I really doubt this is a toke issue because it perfectly works fine when the content type is null. – GETah Apr 21 '16 at 05:53

0 Answers0