Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project upgraded to Laravel 9 - impersonate stopped working #101

Open
martinkiss opened this issue Mar 11, 2022 · 5 comments
Open

Project upgraded to Laravel 9 - impersonate stopped working #101

martinkiss opened this issue Mar 11, 2022 · 5 comments

Comments

@martinkiss
Copy link

Hi,

I have recently upgraded my project to Laravel 9 release and the nova-impersonate stopped working. Trying to impersonate will log me out. Anybody has run into this issue?

I am running Laravel 9 project with Jetstream and Inertia.

composer

PHP - 8.1
laravel/framework: v9.4.1
laravel/jetstream: v2.6.7
laravel/sanctum: v2.14.2
laravel/nova: v3.31.0
kabbouchi/nova-impersonate: v1.11.0

Thanks

@KABBOUCHI
Copy link
Owner

KABBOUCHI commented Mar 13, 2022

plz, can u try this quick fix from 404labfr/laravel-impersonate#154?

comment out the following line in app/Http/Kernel.php:

protected $middlewareGroups = [
        'web' => [
            \App\Http\Middleware\EncryptCookies::class,
            \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
            \Illuminate\Session\Middleware\StartSession::class,
-           \Laravel\Jetstream\Http\Middleware\AuthenticateSession::class,
+           // \Laravel\Jetstream\Http\Middleware\AuthenticateSession::class,
            \Illuminate\View\Middleware\ShareErrorsFromSession::class,
            \App\Http\Middleware\VerifyCsrfToken::class,
            \Illuminate\Routing\Middleware\SubstituteBindings::class,
            \App\Http\Middleware\HandleInertiaRequests::class,
],

image

@martinkiss
Copy link
Author

@KABBOUCHI thanks for the reply.

Commenting out the middleware works, however what are the repercussion of this action?

Downgrading from Laravel 9.4 to 9.3 also fixes the issue. I would rather wait for a stable solution to this problem, then commenting out the middleware?

Any thoughts?

@relaypilot
Copy link

This is the commit that triggered the error:

laravel/framework@50b46db

I am not using Nova, but I am using Jetstream and facing the same error when impersonating customers with the 404labfr/laravel-impersonate package

@nasrulhazim
Copy link

nasrulhazim commented Mar 15, 2022

plz, can u try this quick fix from 404labfr/laravel-impersonate#154?

comment out the following line in app/Http/Kernel.php:

protected $middlewareGroups = [
        'web' => [
            \App\Http\Middleware\EncryptCookies::class,
            \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
            \Illuminate\Session\Middleware\StartSession::class,
-           \Laravel\Jetstream\Http\Middleware\AuthenticateSession::class,
+           // \Laravel\Jetstream\Http\Middleware\AuthenticateSession::class,
            \Illuminate\View\Middleware\ShareErrorsFromSession::class,
            \App\Http\Middleware\VerifyCsrfToken::class,
            \Illuminate\Routing\Middleware\SubstituteBindings::class,
            \App\Http\Middleware\HandleInertiaRequests::class,
],
image

at the moment, am using Jetstream. Not sure commenting will cause an issue to Jetstream behaviour.

@relaypilot
Copy link

relaypilot commented Mar 15, 2022

This should now be fixed if you upgrade to Laravel Framework 9.5.1: laravel/framework#41491

Update: after checking, it didn't resolve it for me, still experiencing the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants