Android Question httpjob/httputils2 interstitial login?

Discussion in 'Android Questions' started by mr23, Feb 16, 2015.

  1. mr23

    mr23 Active Member Licensed 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?

    Attached Files:

  2. Erel

    Erel Administrator Staff Member Licensed 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.
  3. mr23

    mr23 Active Member Licensed User

    Thanks, Erel, for confirming it should work. I worked through it this evening and found success.
    Erel likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice