Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to save user login credentials using PhoneGap API?

I want to save user login credential in my iPhone app, The app is build using PhoneGap and SenchaTouch API's. If the user login through the App, I want to save his userId/Password unless and until he specifically logout. This will save him from login process every time he uses the app and add to user experience.

Any kind of help will be appreciated.

Thanks

like image 593
user842122 Avatar asked Feb 09 '12 22:02

user842122


2 Answers

There is always localStorage. It is a simple key / value persistence that will do exactly what you are looking for.

http://paperkilledrock.com/2010/05/html5-localstorage-part-one/

edit: The above link died: http://diveintohtml5.info/storage.html

like image 57
Devgeeks Avatar answered Oct 02 '22 01:10

Devgeeks


This is how I do it in one of my project :

var login = this.loginField.getValue(),
    pwd = this.passwordField.getValue(),    
    logChain = login + ":" + pwd,
    logChain64 = Ext.util.base64.encode(logChain);

window.localStorage.setItem("YOUR_APP_credentials", logChain64);
like image 27
Titouan de Bailleul Avatar answered Oct 02 '22 01:10

Titouan de Bailleul