JavaScript in Console app ?

Possible to execute JavaScript from a webpage in a console application ?

I have made a application that communicates with a Obix server (XML over http)
The problem is now that the authentication login uses some custom JavaScript for session login.

The login and xml results works fine in a HTMLViewer

Online example
Username = Xojo
Password = Xojo2014

Seems like the webserver give me a javascript that produces a tolken from the username and password.
Any ide how to solve the problem ?

HTMLViewer in console app ? use the same session in a HTTPSocket after login ?..