Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Session variable and cookies with Phonegap on iPhone and Android

I have had problems getting PHP session variables (e.g. $_SESSION['username']) to work within PHP server side code launched via an ajax call from a Phonegap app.

On researching this problem I have found conflicting advice as to whether or not session variables and cookies can be used.

Does anyone have a definitive answer?

If session variables and cookies can be used are there any issues I should be aware of in using them that may have contributed to them not working?

I know that cookies can be enabled for Phonegap apps on an iPhone but as far as I am aware not for Android.

like image 499
Bill Noble Avatar asked Jul 29 '11 14:07

Bill Noble


1 Answers

You would be better off passing the data you would normally store in the session variables to your PhoneGap app via JSON and having the app store it that way.

Think of it like using an external API. The app would authenticate and get back a token. It would store that token and use that to validate further requests to the server were authenticated.

like image 139
Devgeeks Avatar answered Nov 15 '22 09:11

Devgeeks