Ad

Cakephp's Auth Component Logs Me Out Too Quickly. Anyway To Change This?

- 1 answer

This is my first time on StackOverflow though I "read" Coding Horror quite often. Anyway...

I'm working on a school/college project using CakePHP and I'm using the built in AuthComponent to support user Authentication (i.e. logging in, etc).

My problem is that it logs me out after very short intervals. It doesn't even have me wait a full session (i.e. closing browser). Sometimes 5 minutes, sometimes 10 and occasionally 15 but not more.

Worst is when it logs me out when I'm calling a method that requires a user to be logged in and it decides to die right before than.

I've searched quite a bit but I can't seem to find an answer. Any help will be appreciated!

Ad

Answer

I haven't used CakePHP since version 1.1, so I am not sure if this has changed, but you may want to check out your DEBUG level. The lower the DEBUG setting, the lower the value assigned to CAKE_SESSION_TIMEOUT. In 1.1, again, this is all determined in app/config/core.php.

EDIT: Just checked it out, it's been rewritten but the idea remains the same. In core.php look for:

/**
 * Session time out time (in seconds).
 * Actual value depends on 'Security.level' setting.
 */
Configure::write('Session.timeout', '120');

And increase it so that it takes longer to timeout the session.

Ad
source: stackoverflow.com
Ad