-
Description:Impersonating a user only works on routes for Jetstream when you log in via the Nova Login route. logging in via jetstreams auth route then impersonating causes you to be logged out of the session. Detailed steps to reproduce the issue on a fresh Nova installation:
The only thing I how found that fixed this is to remove Not working: Route::middleware([
'auth:sanctum',
config('jetstream.auth_session'),
'verified'
])->group(function () {
Route::get('/dashboard', function () {
return view('dashboard');
})->name('dashboard');
}); Working: Route::middleware([
'auth:sanctum',
'verified'
])->group(function () {
Route::get('/dashboard', function () {
return view('dashboard');
})->name('dashboard');
}); Removing this makes the application less secure so I'm not sure if there is a better solution to this. |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 2 replies
-
I haven't tested Jetstream with Inertia but this can be fixed by adding the following Route::middleware([
'auth:web,sanctum',
config('jetstream.auth_session'),
'verified'
])->group(function () {
Route::get('/dashboard', function () {
return view('dashboard');
})->name('dashboard');
}); and then update 'middleware' => [
'web',
'auth.session',
HandleInertiaRequests::class,
DispatchServingNovaEvent::class,
BootTools::class,
], |
Beta Was this translation helpful? Give feedback.
-
On discord you mentioned that removing |
Beta Was this translation helpful? Give feedback.
-
@seabasss sorry, missed that one. |
Beta Was this translation helpful? Give feedback.
-
Basically if Jetstream enable If your HTTP Kernel doesn't have it, check the latest laravel skeleton: https://github.com/laravel/laravel/blob/ba23174f1cd12b92eca79e1b1f84069a1870317e/app/Http/Kernel.php#L58 |
Beta Was this translation helpful? Give feedback.
-
Awesome! Thanks! |
Beta Was this translation helpful? Give feedback.
-
I have that exact same issue (impersonation works only if I signin from Nova login), however I cannot follow your advice because my Jetstream config file does not contain |
Beta Was this translation helpful? Give feedback.
I haven't tested Jetstream with Inertia but this can be fixed by adding the following
routes/web.php
:and then update
config/nova.php
and addauth.session
: