skcin7
4 years ago
12073
13
Laravel

How to delete all session data, so that users must re-log in?

Posted 4 years ago by skcin7

Hi everybody, I'm trying to figure out how to require all users to sign in when they visit my app again. Basically, remove the session data that keeps them logged in, so that they have to re-log in. I'm fine with removing all session data, but I can't figure out how to do this.

I've tried 3 things so far:

  1. Rebooting the server (thinking this may clear out any data stored in memory).
  2. Deleting all the files in the storage/frameworks/sessions directory.
  3. Removing the data in the remember_token field of the users table.

However, NOTHING seems to be working, and the users are still logged in when the browser is re-opened!! :/

Here's my config/session.php:

<?php
return [
    'driver' => env('SESSION_DRIVER', 'file'),
    'lifetime' => 1,
    'expire_on_close' => true,
    'encrypt' => false,
    'files' => storage_path('framework/sessions'),
    'connection' => null,
    'table' => 'sessions',
    'lottery' => [2, 100],
    'cookie' => 'laravel_session',
    'path' => '/',
    'domain' => null,
    'secure' => false,
];

HELP!!

Please sign in or create an account to participate in this conversation.