Tobias Plaputta
unread,Aug 20, 2012, 5:36:01 AM8/20/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to phonegap
Hi,
when using Basic Authentication, there is an annoying Problem with
Phonegap (all versions so far) in iOS (other Platforms were not
tested):
Setup:
You're trying to make an ajax-request to your server, the server
responds with a 401.
Expectation:
Your ajax-request will now fail, you can read out the status code 401
and tell the user to login or whatever.
This is actually happening that way if your server does NOT send the
401 response together with the "WWW-Authenticate" header, like, for
example, Spring Security does.
If you receive a 401 with WWW-Authenticate, it seems like iOS is
trying to bring up a login dialog which is not shown in PhoneGap, so
you'll end up with receiveing a global ajax fail with error code 0 and
no additional information after the timeout is reached, not giving you
any hint that a 401 occured.
How can I tell phonegap to immediately cancel all incoming WWW-
Authenticate requests to receive the 401 even if this header is sent?
Like said, if this header is not sent from the server together with
status 401, everything word as expected, but you can not always
control that.
Thank you,
Toby