404labfr / 404labfr/laravel-impersonate

When I leave the impersonation, it logs out

未关闭
#165 3 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
PHP
星标
2.3k
派生
235
PR 合并指标
30 天内没有已合并 PR

描述

Laravel Framework 9.19.0

I have tried using the link generated by route('impersonate.leave')
and also with my own controller method and using manually: Auth::user()->leaveImpersonation();

But both ways redirects me to the login page, since it loses the authentication of the original user.

I tried (reading some other issues) using Route::middleware(['auth:web',]) instead of auth:sanctum.
And also add this
```
Event::listen(\Lab404\Impersonate\Events\TakeImpersonation::class,
function(\Lab404\Impersonate\Events\TakeImpersonation $event) {
session()->put('password_hash_sanctum', $event->impersonated->getAuthPassword());
});
Event::listen(\Lab404\Impersonate\Events\LeaveImpersonation::class,
function(\Lab404\Impersonate\Events\LeaveImpersonation $event) {
session()->put('password_hash_sanctum', $event->impersonator->getAuthPassword());
});
```

But problem persists...

Any ideas ?

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。