Question

I am using the helper Sentry::authenticateAndRemember($credentials); to authenticate the user, but after a while (a few days) I get disconnected. The session driver used is the database one.

I investigated the problem and tried to understand how Sentry remembers the authentication of a user. First, in the sessions table, does anyone know what the payload represents ? I have checked the created cookies and I don't understand why but the expiration date is set for a month later (whereas in the source code it looks like it is set 5 years later). Also, I have tried to log the user in without remembering him (Sentry::authenticate($credentials, false);) and I get the exact same cookie created, so I don't get disconnected when exiting my browser.

Does anyone have any clue explaining anything that I said ?

Was it helpful?

Solution

I found the solution of my problem, in php.ini the variable session.gc_maxlifetime was set to 1440. This setting specifies the number of seconds after which data will be seen as 'garbage', so after 24 minutes my session was invalidated.

After setting it to 2592000 (30 days) the issue was solved, I hope this will help someone.

OTHER TIPS

In Sentry2 with Laravel 4.1 the Cookie expiration date is in vendor>caralyst>sentry>tests>CICookiesTest.php line 61.

The default being just 1440 seconds, so pretty easy to make that stick for a good bit longer.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top