404labfr / 404labfr/laravel-impersonate

When I leave the impersonation, it logs out

オープン
#165 コメント 3 件 リアクション 1 件 担当者 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 を短くまとめたダイジェスト。