PDA

View Full Version : Simple user authentication using Sencha Touch MVC + PhoneGap



ardnet
3 Jul 2011, 6:17 AM
Hi all,
How to setup simple user authentication using Sencha Touch MVC + PhoneGap?
For getting the authentication, do I have to use ScriptTagProxy with JSONP also?

Sorry, if this sounds like a very newbie question (yes, I am very newbie btw :) )

Any hints, or some really simple snippet of code would be greatly appreciated.
Thanks in advance.

Ardi

ps:
About the server side, I already got it handled.
I just need to know how to setup in the client side, as in the Sencha Touch framework.

Thanks

heringsfilet
6 Jul 2011, 1:58 AM
Im facing similar questions:
How do you want to authenticate a user?
with username and password or with an API-key?
Should I send it as a "normal" parameter or in the header?

Jack9
6 Jul 2011, 10:11 AM
Wrapping something up in PhoneGap requires a simple Javascript wrapping function around the Ext.Setup({...}) and XCode to build it (for iPhone). Don't worry about that. That's the easy part.

Getting your sencha app working the way you want is more complicated. Get a working app on Chrome, using the webservices you want and the rest is easy.

ardnet
7 Jul 2011, 7:05 AM
hi heringsfilet and Jack9, thanks for responding,

Well, just FYI, I'm using Drupal as the backend, so using REST with JSON. And by passing username and password using POST, I'll get something like session Id, which is this is the information for me to keep it in the client, that's how it work.

My problem is just, how the syntax in Sencha MVC Framework (and PhoneGap) to do this?
My code would be something like this: http://www.sencha.com/forum/showthread.php?139200-Problem-submitting-form-using-Sencha-Touch-MVC

Should I use Ajax or ScriptTag (with JSONP) for this?

And also, do all connection to server should use ScriptTag all the time if it's for native app?
And should I use sessionStorage.setItem for saving that session id? so I can just use it anywhere in the app to access certain information of that current user logged on from the server? (I got the idea from here: http://www.sencha.com/forum/showthread.php?137647-Need-help-on-Session-management-of-Sencha-touch )
And again, how's the syntax for this?

Sorry, been struggling with this quite some time :)

Thanks in advance.

Ardi