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

olie's avatar
Level 1

Laravel 8 lost auth session after redirect

Hi ! I use a custom provider to authenticate my user. The authentication work but I think I lost the session after redirect. I know the authentication works because I can log the user (with Auth::user()) before redirection, this is my login method :

public function login(Request $request){
        if (Auth::attempt(['email' => $request->get('email'), 'password' => $request->get('password')])) {
            Log::info(print_r(Auth::user(), true));
            return redirect()->intended($this->redirectTo);
        }
    }

But the Auth::user() is null in my redirection. My SESSION_DRIVER is file and when I login, I have a new file created.

Can you help me ? (I can share more code but I don't know what do you need to help me) Thanks

0 likes
0 replies

Please or to participate in this conversation.