404labfr / laravel-impersonate

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

does it work with auth0? #188

Open oriana-zippin opened 5 months ago

oriana-zippin commented 5 months ago

Hi, I'm trying to make some upgrades usign auth0 7.12 and impersonate, and trying to use the auth0 guard but I'm getting this error: Call to undefined method Auth0\Laravel\Guards\AuthenticationGuard::quietLogin()

Before that I was using impersonate with the web guard and worked fine.

Is there a way I can use auth0 with this package?

jose123v commented 4 months ago

You have to extend auth0 guard and replace it, on you custom auth0 guard you have to implement quietLogin and quietLogout logic.

https://github.com/404labfr/laravel-impersonate/blob/d8ab69f05daab4117b313e11ca007fbf3199a1ab/src/Guard/SessionGuard.php#L8-L38 https://github.com/404labfr/laravel-impersonate/blob/d8ab69f05daab4117b313e11ca007fbf3199a1ab/src/ImpersonateServiceProvider.php#L131-L134

ComputerTinker commented 3 months ago

Good afternoon. I'm running into an issue getting Auth0 and Laravel-impersonate working together as well, although for me the only error I see in my logs is Unauthenticated. which looks as though it's being thrown by vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php

@jose123v your idea of extending the Auth0 guard sounds promising, but unfortunately their AuthenticationGuard is defined as final class AuthenticationGuard extends GuardAbstract implements AuthenticationGuardContract, and because of the "final" it cannot be extended.

Is there a different way to go about this?