#Authentication not working

1 messages · Page 1 of 1 (latest)

stray wyvern
#

On NativePHP Desktop, after my oauth procedure, I do this:

$user = User::query()->updateOrCreate([
...
], [
...
]);

auth()->login($user);
request()->session()->regenerate();

Flux::toast('Successfully authenticated', 'success');

return redirect()->route('dashboard');

If I
dd(auth()->user());
right after
auth()->login($user);
I get my user.

BUT: If I dd my user on the dashboard, I get null.
When I add the auth middleware to the dashboard, I get redirected back to my login.

I am not sure if this is NativePHP related or if I am just dumb, but I would appreciate any help or ideas :)

#

Oh and I tried all different SESSION_DRIVER values already

summer zodiac
#

Hmm no idea that should work 🤔

Does it make a difference if you don’t regenerate the session id in your example?

polar fox
#

This happens to me when use a Window to login user then user another Window to to all other things, I thought this was related with some kind of WIndow cache or something like that

stray wyvern
stray wyvern