I’d like to make my app stay logged in until the user actually logs out. It currently randomly logs people out and they have to log back in which is a pain on mobile. How can I keep the user logged in on mobile?
Might be worth checking server side what your session timings are Brad. Increase the amount of time server side and the session should/will persist for that set period. Sometimes this can override other settings you may configure. Same for cookies too. If you don’t have access to configure the server directly you may be able to find a .htaccess hack/work-around to allow you to define the variables there to achieve the same.
You need to adjust in your php.ini:
; After this number of seconds, stored data will be seen as ‘garbage’ and
; cleaned up by the garbage collection process.
; http://php.net/session.gc-maxlifetime
session.gc_maxlifetime = 80000
We also do this on the login page for example. Have a check exists action to see if a session exists if it does forward to the desired area (saves user logging in again)… If unauthorized (ahhh hate Z’s should be unauthorised, petty I know hahaha) redirect to prompt for login.
No not necessary. But you could use a scheduler action to refresh the clients credentials every 20 minutes or so while they are in their user area for example...
Its simple:
We have an index.html file with two dynamic actions based upon a response. This index page calls to see if a user profile exists for the user, which if the session is alive, should exist otherwise its unauthorised (security provider attached to the user profile action in Server Connect so returns either success or unautorised). In the index page (dynamic actions for the user profile) the redirects are based upon this return. So if unautorised redirect to index_login.html (or you could use a show/hide div with a login form, but we prefer to see the redirects for logging/monitoring), and if it does exist forward to the designated user area. No more complicated than that really...
Theoretically when the user opens your application and it calls the index.html page the above happens saving users from repeatedly logging in as they are directed straight to their user area…