Welcome Guest, Not a member yet? Register   Sign In
CI 4.3.5 - Session Expiration Not Working
#11

(This post was last modified: 01-17-2024, 02:10 AM by shashi.)

(01-16-2024, 11:53 PM)kenjis Wrote: I don't understand what is your exact issue? "does not work" explains nothing.
It is better to show what you want and what was happened.

7200 means the lifetime of the session cookie. You can see the value in your browser's developer tool.
If the time has passed (in the browser's clock), the browser deletes the cookie, so the user must re-login.
But if the session data in your server is deleted, the user must re-login when the session cookie still exists

That what i means to say

After setting

Code:
public int $expiration = 7200; // 2 hour

Even after setting above, the browser is not deleting the session / cookie, so the user re-login. Users are still login only, i to tested - waited almost 4 hours and still Login only.

I have to delete session data from writable >> session folder manually so that users must re login. but that is not solution , its should work with


Code:
public int $expiration = 7200; // 2 hour
Reply
#12

Okay, your issue is that the session cookie in the browser is not deleted.
You can check the expire datetime of the cookie in developer tool in your browser.
Check it.

For example:
ci_session:"phc6i4r70sbsq04vhpfp9tdkui866m3b"
Created:"Wed, 17 Jan 2024 09:54:32 GMT"
Domain:"localhost"
Expires / Max-Age:"Wed, 17 Jan 2024 11:54:32 GMT"
Reply
#13

Thank for reply

I have seen that in developer tool

ci_potsion:"phctdkui866m3b......."
Created:"Wed, 17 Jan 2024 9:12:38 GMT"
Domain:"localhost"
Expires / Max-Age:"Wed, 17 Jan 2024 9:12:38 GMT"

And the time has passed away.

Still login only.
Reply
#14

(This post was last modified: 01-17-2024, 07:56 AM by shashi.)

One thing I noticed is

Set cookies which is seen in developer tool header section, with expire date .

I see it sometime and sometimes I don't see. ( In localhost )

But can see at

Open Developer Tools
Click the "Application" tab
Cookies are listed under the "Storage" list item on the left sidebar

I see expire date here , but it's getting automatically updated after every 2-3 min
So suppose expire date seen is

17-01-2024 10:24:23

After 2-3 minutes

I see

17-01-2024 10:29:05

I waited till time but still login only.
Reply
#15

The session cookie is regenerated periodically based on the config $timeToUpdate.
So if you access to your site, the session cookie may be updated.

I don't know why your expired cookie remained in your browser.
I checked with Firefox, and the cookie that was created yesterday was deleted.
Reply
#16

Thank for the reply.

I too taught it might be my Firefox browser issues.
Hence I tried chrome , but the result is the same, still login only. It's been 24 hours and still login.

Can you please see with expire time = 43200

That's with 12 hour.
Reply
#17

(This post was last modified: 01-19-2024, 02:26 AM by shashi.)

So basically,

Expire =12 hour only works, if users didn't access website.

If she/he access the website the session expire time gets updated automatically.

Because once I saw
expire :max age = 2024-01-19:12:09:44

And after 4 hour I came and refresh the page and now I see
Expire :max age = 2024-01-19:20:29:24

Hence what I want is not working, that's is after 12 hours users should be logout even they access website. Which I guess was working in 4.1.1.

Or we can have both options.

That's expire in 12hours, even users access.

And

If users access then the session expire/max age get updated automatically,which is happening now.


So we can use as per need.

Thank
Reply




Theme © iAndrew 2016 - Forum software by © MyBB