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

Cushty's avatar

User switching randomly to different user in Inertia

Hi, I have a very strange bug where I log in with one user , click around, log out of that user, login with another user click around and on the settings page im literally another user. i can press the back and forward buttons on chrome and see the 2 users emails addresses in settings.

I did some testing in Tinker and when the bug happens, it seem like im getting logged out and logged in with another user.

Have you ever encountered this?

React, Inertia, Hope you can help, thanks

0 likes
5 replies
ryangurnick's avatar

Can you share some of the code related to your settings page?

I suspect that there is some amount of caching causing issues but its quite hard to know for sure from a description of a problem without code.

Cushty's avatar

@ryangurnick

It's so strange, I can literally see the other user, if I hard refresh it goes away and i see the logged in users details. Hope you can help, at a total loss

jlrdw's avatar

Are you correctly logging out, something like this:

    public function logout(Request $request)
    {
        Auth::logout();

        $request->session()->invalidate();

        $request->session()->regenerateToken();

        return redirect('/');
    }
Cushty's avatar

@jlrdw Im using the default logging out supplied by Laravel React starter kit, I havnt touched that file.

Please or to participate in this conversation.