0

I have a Cordova based application that requires Basic Authentication. The authentication is done in JavaScript using AJAX. I am running into an issue where if the user types in invalid credentials, the client is never receiving the 401 Unauthorized response that is sent by the server. Instead, the request times out. I was able to resolve this on iOS by setting the async:false parameter as suggested by this thread: iOS: Authentication using XMLHttpRequest - Handling 401 reponse, but it does not resolve the issue on Android. Any suggestions as to how resolve this? It's not optimal to have users wait for the timeout to know that they entered an invalid password. Thanks in advance!

Community
  • 1
  • 1

1 Answers1

0

Judging from the same question in the IBM developerWorks forum http://www.ibm.com/developerworks/forums/post!reply.jspa?threadID=470690, this seems to be a Worklight-related question.

====

The Basic Authenticator is not meant for use in the context of Mobile applications. For this, I would recommend using adapter-based authentication.

With adapter-based authentication, you also have onSuccess and onFailure in addition to timeout. Thus, if providing incorrect credentials, you will not have to wait for the timeout, rather you will get onFailure.

See the following topics in IBM Worklight's Getting Started page:

And more specifically:

Idan Adar
  • 44,156
  • 13
  • 50
  • 89