It's all about the answers!

Ask a question

How do I do OAuth authentication through DWA in C# .NET ?


Louis MADEUF (432611) | asked Jun 20 '12, 5:32 a.m.
edited Jul 03 '12, 9:18 a.m. by Geoffrey Clemm (30.1k33035)
Hello, 

I'm having trouble with the OAuth authentication. 

I am working on the development of a tool working with DOORS and to access the data from DOORS database I need to authenticate through DWA using OAuth.
So I wrote my own OAuth-REST authentication routine in C# .NET but I seem to get an http 401 error when I try to authorize my request token in certain cases.

Here is what happens :

  • - I request a request token at http://localhost:8080/dwa/oauth-request-token. It works, I get my token.
  • - I ask the user to authenticate to authorize my request token : a browser opens to https://localhost:8443/dwa/oauth/oauth_login.jsp for him to enter login and password but the submit button does not lead anywhere, no confirmation that the used is logged in is shown.
  • - OAuth authentication fails because the request token is not authorized (http error 401)

---> Though, I was able to authenticate properly via OAuth IF a DWA session was opened before at http://localhost:8080/dwa/welcome/welcome.jsp

But I feel like this is not the proper way OAuth should work. Its purpose it to make the user authenticate during the OAuth routine running in the background. And this is what the page at https://localhost:8443/dwa/oauth/oauth_login.jsp has been made for : it is its only purpose as its URL seems to suggest.

What am I doing wrong ? What did I not understand ?
I used RestSharp to develop my small client (http://restsharp.org/) but this problem seems DWA related.

In paralel, does anyone knows how to get a hold of the OAuth verifier in my client ? I can only do that manually...

Thank you very much in advance,
Louis 

One answer



permanent link
Louis MADEUF (432611) | answered Jul 03 '12, 6:33 a.m.
Hello everyone,

I have made some progress on the subject and all this is no longer an issue. 
I am now using DOORS 9.4 + DWA 1.5 and the OAuth authentication seems more stable and runs the version 1.0 and 1.0a, since v2.0 is still on a draft state (Source from IBM).

Regarding my problems, if you encounter the same or similar ones, here are some tips you should check :

have you set a valid callback_url ? look at the OAuth specification on : http://oauth.net/
If you did not set it properly, you will not be redirected. If it was absent, you will not be authenticated because it is required in the first request.
The OAuth login page of DWA works fine and even says if you put in bad credentials. If you put the right ones it will redirect you.
RestSharp is very useful and simple library for writing your own custom REST-OAuth client, I recommend it strongly. you can find it here : http://restsharp.org/

I hope this will help some of you !
This issue is now closed. 

Comments
Jose Miguel Ordax Cassa commented Nov 23 '12, 8:32 a.m.

Hi Louis, I am having problems when doing the authorization of the token.
My code is already authenticated, so I don't get the login page (the problem you commented) but the URL I receive to do the authorization doesn't exist.
It is like this:
....../dwa/oauth?oauth_token=a4b085f4-c969-4d22-b888-7623f3fb28d4&oauth_verifier=RdwnBo
How is the URL you are getting?
When I try this URL I get HTTP 404.

I am using DWA 1.5.0.0

Thanks in advance,
   Chemi.


Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.