iphonerubysessioniphone-web-appexpired-sessions

How to prevent the need to login everytime an iphone web app is launched


I'm creating a web app for an iphone using ruby on rails 3.

If I add the app to my iphone home screen, everytime I launch the app, I need to login again.
I also just realized that when I close the browser on my PC and reopen it, I lose the session as well.

Is there a way to prevent that?

Ultimately, I'm trying to prevent the need to login everytime a user launches the web app from the 'home screen'; e.g. instead make it every 7 days or so.


Solution

  • Yes, instead of storing the login info in a $_SESSION variable, store it in a $_COOKIE. The cookie will be saved depending on when you set it to expire (in your example, 7 days). As long as they log in "inside" the web app, or the regular web version (and the cookie is the same) they will not have to log in every time or when switching between the two.