Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to authenticate w/o internet access in PhoneGap?

I have an iPad app built using Sencha Touch for sales reps. The problem is, some of the users sell out in the boonies and don't have internet access. Hence, we want to build a "native" iOS app that will allow them to use the app even without internet access. I am hoping to use PhoneGap in order to use a lot of the current code.

The problem I'm running up against while I plan this out is authentication.

Currently, the app authenticates the users against a remote database using PHP. With the native PhoneGap app, is there any way for me to handle authentication locally when a user doesn't have internet access? Can I make a local option secure, and if so, how? Is it as simple as authenticating against an XML or JSON file in my PhoneGap project?

Note: I know this comes across as totally ignorant to those who understand it and I apologize. I've never worked with anything other than pure web technologies, where client-side and server-side are clear to me. Haven't done anything with compiled languages.

I don't understand how secure JS is (or if it is at all) when using PhoneGap to package it up as a a native app. Is it as transparent as it would be on the web?

Can a malicious user with the app installed on their phone see my JavaScript etc.?

like image 297
timmyc Avatar asked Nov 14 '22 18:11

timmyc


1 Answers

The first time the user logs in successfully over the internet, store necessary variables in localstorage (i e username and password hash). Then use those variables to authenticate if the user is offline. It is not possible to view source code or scripts in any simple way once the app is packaged with Phonegap.

like image 160
Per Quested Aronsson Avatar answered Dec 15 '22 07:12

Per Quested Aronsson