Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

shimana's avatar

Truncate the remember_token table after logout

I used a Livewire component to log the user out of the system.


namespace App\Livewire\Backend;

use Illuminate\Support\Facades\Auth;
use Livewire\Component;

class Logout extends Component
{

    public function logout()
    {
        Auth::guard('web')->logout();
        return redirect()->to('/');
    }

    public function render()
    {
        return view('livewire.backend.logout');
    }
}

When a user enables the remember_token option, a string is inserted into the remember_token table. Shouldn't this field be truncated when the user logs out?

image1

after logout

image1

I tested it and found that when the user logs out, the remember_token field is not truncated, but rather regenerated. Doesn't this create a security issue? Shouldn't the field be emptied instead?

0 likes
1 reply
Snapey's avatar
Snapey
Best Answer
Level 122

better to be a random value that noone knows than a predictable null

1 like

Please or to participate in this conversation.