basic authentication behaves differently in simulator and on android device?

Thread is closed for posting
3 posts, 0 answers
  1. Denise
    Denise avatar
    13 posts
    Member since:
    Oct 2013

    Posted 01 Dec 2013 Link to this post

    Hi ---

    I have run into difficulties with an app that accesses a remote web api via basic authentication.  In the simulator, the my app runs fine.  When I deploy to a connected android device, the app fails to send the HTTP_AUTHENTICATE header, and thus fails to authenticate.  I've verified that the app does in fact get the username/password info correctly, it just isn't sending it.   The relevant app code is quite simple:

    return $.ajax (
        username : window.localStorage.username,
        password : window.localStorage.password,
        datatype : "json",

    Is this expected?
  2. Denise
    Denise avatar
    13 posts
    Member since:
    Oct 2013

    Posted 02 Dec 2013 Link to this post

    I fixed this problem by switching to a different way of attaching the header (as required for older versions of jQuery):

        headers: {
            'Authorization': "Basic " + btoa(window.localStorage.username + ":" + window.localStorage.password)

    This does seem like a bug in the simulator.  Is the deployed app running a different version of jQuery than the simulator does?  And if so, why?, or more importantly: how can I tell?
  3. Steve
    Steve avatar
    10941 posts

    Posted 03 Dec 2013 Link to this post

    Hi Denise,

    The Icenium Simulator uses the jQuery version present in your project and referenced in your files. If the original problem is present only on the deployed app, you should consider using FiddlerCap to track the request/responses between the app/server or remote debugging with jshybugger.

    You've missed the Icenium Visual Studio Integration keynote? It has been recorded and posted here.
    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Share feedback and vote for features on our Feedback Portal.
Back to Top