Auth0 Home Blog Docs

Laravel Impersonation with Auth0?

For context I’m using Auth0 with a Laravel Spark application, now before I integrated Auth0 I was able to use Spark’s feature of impersonation… It primarily did this through the ImpersonationController here:

Now after integrating the Auth0 authenication I’m no longer able to do this succesfully, the commented out dd(auth()->user()), does actually dump the selected user who is being impersonated, but I believe that after this maybe the Auth0 middleware is being hit and the session is reauthenicated back to the original user?

Is there maybe a way of deleting the Auth0 cookie or something? I’m a bit out of my depth here…

Actually deleting the cookie was a silly idea, obviously it doesn’t work because then the website just treats you as unauthorized and redirects you to an Auth0 login.

Any ideas on how I can achieve this? Maybe an edit to the auth middleware?