LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Enable in-application web authorization?

Solved!
Go to solution

I am working on implementing an API for a web site.

They require OAUTH tokens.  In a web browser, this is pretty simple (GET URL, response opens a pop-up, user logs into site, allows authorization, pop-up closes and a token is delivered to the application.

So I have come as far as requesting the token in LV.  The server is responding with HTML for a login page.  I suppose I could pop open an IE window via ActiveX (haven't tried it with .NET), but it seems like there should be a better way.

 

Any ideas? 

0 Kudos
Message 1 of 3
(2,322 Views)
Solution
Accepted by topic author Jed_Davidow

Hello Jed,

 

Please take a look to the linked examples below about using ActiveX to open a web browser.

 

Building a Simple Web Browser Using ActiveX

 

ActiveX Internet Web Browser Using Event Structures in LabVIEW

 

Regards,

 

Alina M

0 Kudos
Message 2 of 3
(2,310 Views)

Thank you.  I figured this was the proper solution, but I had been hoping for something a little more elegant.

Some notes for others trying to get AUTH to work...

 

1) Nav to the LOGOUT link for the site first.  There's probably a way to do it, but the MS web browser control cached credentials and I could not figure out how to clear them programatically.

2) I then Nav'd to the Auth link, and the site returned a Login screen.  logging in DID NOT trigger either a "Navigation complete" or "Title Changed" event.

3) The next page after logging in was the Auth page.  After completing this, the site returns a non-formatted simple HTML page with the Auth token that can be scanned by code.  The Event triggers for "Navigation Complete" at this time.

 

I am aware that this behavior might be specific to the site, but I am surprised that the "Nav complete" trigger did not fire when the site returned the first login page.

Also, in order to read the HTML into LV you need to retrieve the document after the navigation, and cast that to a specific class, then pull out the HTML- it's not as simple as I would expect it to be.

0 Kudos
Message 3 of 3
(2,303 Views)