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

695-a-laravel-package-to-impersonate-users #128

Open
utterances-bot opened this issue Mar 8, 2022 · 6 comments
Open

695-a-laravel-package-to-impersonate-users #128

utterances-bot opened this issue Mar 8, 2022 · 6 comments

Comments

@utterances-bot
Copy link

A Laravel package to impersonate users - Freek Van der Herten's blog on PHP, Laravel and JavaScript

https://freek.dev/695-a-laravel-package-to-impersonate-users

Copy link

core45 commented Mar 8, 2022

Looks like this package doesn't work correctly with Jetstream. Freek - did you test it with Jetstream/Sanctum maybe?

@freekmurze
Copy link
Owner

No, Jetstream / Sanctum didn't exist in 2017.

Copy link

onlime commented Mar 10, 2022

@core45 please describe the problem in a bit more detail. I'd like to know what does not work before I dig into it. Will try it out on a Jetstream Inertia+Vue stack project.

Copy link

onlime commented Mar 10, 2022

@core45 it so far works great on my Laravel 9 Jetstream project!

Copy link

onlime commented Mar 16, 2022

Ok, you were right @core45, laravel-impersonate didn't play nicely together with Jetstream. I have only tested on Laravel v9.3.1, but since having upgraded to v9.5.1, I experienced the same issues. @luigel has posted a workaround here:

404labfr/laravel-impersonate#154 (comment)

e.g. in web.php:

//Route::middleware(['auth:sanctum', 'verified'])->get('/dashboard', function () {
Route::middleware(['auth:web', 'verified'])->get('/dashboard', function () {
    return Inertia::render('Dashboard');
})->name('dashboard');

so, AFAIK, laravel-impersonate currently only works on standard auth middleware and accessing some route behind Sanctum middleware would cause the user's session to be logged out.

@core45
Copy link

core45 commented Mar 16, 2022

Unfortunately I must use Laravel 8. And this solution with auth:web does not work. So I'm leaving it until I'm able to upgrade to 9

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