Hey @danielhe4rt
Do you see those 2 lines in your env file?
SESSION_DRIVER=file
SESSION_LIFETIME=120
Or you maybe changed it to something else and it simply does not work regardless of your 3rd party auth process?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I'm trying to make some 3rd party authentication on my application but when I get redirected, the session vanish and I don't really know why it is happening.
Here's my code:
public function getAuthenticate(Request $request)
{
$code = $request->get('code');
$service = new DiscordService();
$auth = $service->validateToken($code);
$userData = $service->getAuthenticatedUser($auth['access_token']);
$user = User::where(['email' => $userData['email'] , 'discord_id' => $userData['id']])->first();
if(!$user) {
$user = User::create([
'name' => $userData['username'],
'email' => $userData['email'],
'discord_id' => $userData['id'],
]);
}
Auth::login($user);
if(Auth::check()) {
dump('workss');
}
}
Here is where i'm trying to check:

After I do the 3rd party authentication:

Back to the home page to check if has any authenticated object there:

Any clue of what is actually happening here?
Please or to participate in this conversation.