This is a migrated thread and some comments may be shown as answers.

basic authentication behaves differently in simulator and on android device?

2 Answers 94 Views
jQuery Mobile
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Denise
Top achievements
Rank 1
Denise asked on 02 Dec 2013, 02:25 AM
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 Answers, 1 is accepted

Sort by
0
Denise
Top achievements
Rank 1
answered on 03 Dec 2013, 04:42 AM
I fixed this problem by switching to a different way of attaching the header (as required for older versions of jQuery):

$.ajaxSetup({
    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?
0
Steve
Telerik team
answered on 03 Dec 2013, 03:51 PM
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.

Regards,
Steve
Telerik
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.
Tags
jQuery Mobile
Asked by
Denise
Top achievements
Rank 1
Answers by
Denise
Top achievements
Rank 1
Steve
Telerik team
Share this question
or