How to implement a first-time-only login scheme for a mobile web application implemented with jQuery Mobile, PhoneGap, and Django? How to implement a first-time-only login scheme for a mobile web application implemented with jQuery Mobile, PhoneGap, and Django? django django

How to implement a first-time-only login scheme for a mobile web application implemented with jQuery Mobile, PhoneGap, and Django?


I would advise against storing in HTML5 local/web storage. If you are targeting iOS PhoneGap, I would recommend using the Keychain Plugin:http://blogs.nitobi.com/shazron/2010/11/06/ios-keychain-plugin-for-phonegap/


Although you're not going with Sencha Touch, there's a pretty good overview of the issues at HTTP Authentication.

As for storing the authentication information after an initial login, you could try local storage or a cookie (though you might need to use PhoneGap to enable cookie storage). HTML5 also provides key-value local client storage. If authentication cookies work I believe this could be handled automatically for you; otherwise you could implement a document.ready authentication check within an Ajax call using authentication data from local storage (or encrypted storage).


The KeyChain solution would work only on iOS devices, so if that's your only target you are fine.

But what about the others? Kind of a waste using PhoneGap but then deploying only to one framework...

I know localStorage is not secure, but if you are aware of the limitations there are ways to make a bit less "obvious".

Here's the jQuery.handleStorage plugin which also handles AES encryption... You could have a look at the source and implement only the parts you need (in case you don't want to use the whole plugin, which also supports desktop browsers!).

PS: I am not affiliated in any way to that plugin or the author