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

Seeing 403's after basic Laravel 9 install #170

Open
imacrayon opened this issue Oct 5, 2022 · 4 comments
Open

Seeing 403's after basic Laravel 9 install #170

imacrayon opened this issue Oct 5, 2022 · 4 comments

Comments

@imacrayon
Copy link

imacrayon commented Oct 5, 2022

Using Laravel 9.34.0 and stock session auth driver.

Installed the package:

"lab404/laravel-impersonate": "^1.7",

Added Impersonate trait to app\User.php:

use HasFactory, Notifiable, Impersonate;

Added the route helper at the top of routes/web.php:

Route::impersonate();

Navigating to /impersonate/take/2 displays the "403 | Forbidden" error page.
Navigating to / shows I am impersonating user 2 as expected.
Navigating to /impersonate/leave again displays the "403 | Forbidden" error page.
Navigating to / shows I am logged in as the original user again.

Any idea why the impersonate routes are not redirecting and instead returning a 403?

@warmwhisky
Copy link

Same here. Did you find a solution?

@warmwhisky
Copy link

I was trying to login as my self as I was the only user. When I added another user it worked.

But I ran into strange behavior where sometimes it would work and other times it would just take me to the login screen when I tried to impersonate or leave impersonation.

I have my own solution to login in and I could only get the login link to work when pasting it into an incognito window. I also put a unique hash on my solution so ids cannot be guessed.

I like the idea of this package being able to login and out of another user, but from taking a look at the issues there seems to be a few unresolved issues regarding being taken to the login screen when trying to impersonate which is exactly what I experience both with this package and my own custom solution.

@tonypartridger
Copy link

tonypartridger commented Feb 7, 2023 via email

@warmwhisky
Copy link

You should not login as yourself as that just causes confusion, create another user and test that.

As I said: I added another user and it worked. Though it is confusing to get a 403 and no other feedback.

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

No branches or pull requests

3 participants