Android Question httpjob/httputils2 interstitial login?

mr23

Active Member
Licensed User
Longtime User
I'm trying to find a way with a non-activity (ok, a Widget Service, or just a plain Service) to 'login' to a particular web service. That server, upon not having a websocket authenticated session, serves up a login page. It uses LuCI, and is described as an interstitial login page. The goal is to get into the server w/o any modification to the server. It is essentially a dd-wrt router. Post login a page is served with an auth token.

From an activity I am successful using a WebView with WebViewExtras to executeJavascript through B4a.CallSub to a processHtml type solution, but can't use that in a Widget Service (did try anyway, failed). Basically I'm looking for the equivalent logic without the view. By the way, _userandpasswordrequired is not getting called. If I get access to the source for webview (or flingable), would I be able to extract the logic from the view?

I didn't find a way to, with httpjob, Post a user/pw to the login form on this particular server. It is serving up the attached source page. Is it possible to use httpjob to post a login user/pw ? Perhaps I just made a mistake.

With the standard B4A HttpUtils2 setting .Username and .Password on a HttpJob (unlikely longshot) didn't work. With .u and .pw httpUtils2 uses ExecuteCredentials.

Found in the B4J area this thread about InitializeAcceptAll for B4A HttpUtils2Service. Probably another unlikely longshot. No, I'm not an expert on luci/etc.
Is there an equivalent for B4A? Would InitializeAcceptAll help for this case?
Tried using the one from there, slightly modified (removed fx) but get
java.lang.RuntimeException: Code module does not support this method.​
for CallSubDelayed2(HttpUtils2Service, "SubmitJob", Me)
by the HttpJob download2 from that same thread's attachment. Longer error text attached.

I did try storing the authentication information from an App webview successful session, but the server is seeing the httpjob as another source, thus I need to re-auth. Is there a way to spoof that?
 

Attachments

  • SampleLoginFormPage.txt
    6.5 KB · Views: 347
  • B4JsHttpUtils2ServiceHttpJobError.txt
    1.1 KB · Views: 291

Erel

B4X founder
Staff member
Licensed User
Longtime User
InitializeAcceptAll is not related to this authentication. The same is true for Username and Password fields.

I recommend you to install Firebug or a different browser development plugin and learn what happens when you log in to this page.

It makes a POST request to /cgi-bin/luci. You will need to create a similar request.
 
Upvote 0
Top