Remove Session By ID?

Hi all. I’m currently using session authentication and want to log out my authenticated users after X number of minutes.

Is there a way to auto logout a specific user?

I can maybe save the session id, if there is, in the database and add expiration time then create a cron job though I have no idea, and I can’t see it in the documentation, on how to get the session id and log out that session by id?

Is there a way to do this? Any help would be much appreciated.

I do a command like this, to delete sessions after 2 inactivity hours, like this

1 Like

it is not the best way but I had to be harry to finish the project, then to refinement this option.

I am running it by a cron job.

later I will help them to improve this part in session package, which missed a session garbage collector.

Hello. Thank you for your answer. This only works for file based session right? How about cookie based? Have you tried implementing it already?