1

I have a windows desktop application. I need to open SSO login page in windows application. For this, I am using windows web browser control to open SSO login page. Once successfully logged-in, I need to get Authorization header from SSO login and use this authorization token for consecutive REST calls.

The issue here is, I am not able to extract authorization header Navigated and DocumentCompleted events. Can anyone suggest how I can extract this authorization header from the first call and how I can use the same header for subsequent REST calls?

Thanks in advance!!

Sunny Jangid
  • 578
  • 4
  • 19
Ashok
  • 197
  • 3
  • 17

1 Answers1

1

I resolved this myself.

As I explained in question, for Entitlement login, I'm login to actual website login page. Once I logged in to login page, I receives authorization token from response in DocumentCompleted event. And I am using same token for subsequent REST calls.

Ashok
  • 197
  • 3
  • 17
  • wow excellent! I need same thing to do can you give me the steps to capture authorization token from response in DocumentCompleted event – Rama Krishna Oct 25 '17 at 05:40
  • Are you using Siemens Entitlement Services or something else? – Ashok Oct 25 '17 at 05:54
  • I didn't get you – Rama Krishna Oct 25 '17 at 06:22
  • I am using Java REST APIs to authenticate user – Rama Krishna Oct 25 '17 at 06:24
  • it looks like you are not using WebBrowser .net control to show SSO/Entitlement login page. Can you please explain complete end to end scenario what you have and what you want? – Ashok Oct 25 '17 at 06:27
  • I am using WebBrowser .net control only for SSO (One login) login page – Rama Krishna Oct 25 '17 at 06:28
  • Yes..thats what is expected..and in this control...you need to parse authentication token.. string docu = this.wbEntitlementLogin.DocumentText.ToString(); int authIndex = docu.IndexOf("Authorization: \""); int authEndIndex = docu.IndexOf("\"};"); if (authIndex != -1 && authEndIndex != -1) { string authToken = docu.Substring(authIndex + 16, ((authEndIndex) - (authIndex + 16)));} – Ashok Oct 26 '17 at 06:30
  • This all stuff we need to write in DocumentCompleted event right? – Rama Krishna Oct 26 '17 at 06:36
  • yes..but this is valid if your web site page is returning authorization token in home page after login...make sure this – Ashok Oct 26 '17 at 06:37
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/157549/discussion-between-rama-krishna-and-ashok). – Rama Krishna Oct 26 '17 at 08:40