404labfr / laravel-impersonate

Laravel Impersonate is a plugin that allows you to authenticate as your users.
https://marceau.casals.fr
2k stars 202 forks source link

I can't get impersonation to work with sanctum/jetstream #144

Closed Ifriqiya closed 2 years ago

Ifriqiya commented 2 years ago

I have successfully used this package in 2 projects, the most recent using laravel breeze starter kit. But I'm trying to use it on a project that uses laravel sanctum and I get logged out on trying to impersonate another user.

I used Telescope to compare the successful usage on previous project and I can see that the current user session id is not deleted and replaced with a new one, rather, the same details is used to attempt to 'update' 'sessions' and fails.

Is there something I've done wrong?

Ifriqiya commented 2 years ago

The code from another issue: https://github.com/404labfr/laravel-impersonate/issues/141#issuecomment-873529044, resolved this for me but only when I use it along with this: https://github.com/404labfr/laravel-impersonate/issues/134#issuecomment-861338902.