Hello,
I'd like to help, but need to know first – how the impersonation is implemented?
When admin wants to impersonate user X, I just generate JWT token for user X and that's it. I solved it by using Middleware + Singleton, so on each request I check JWT token and its claims and then I set value in SIngleton and then I use that Singleton to check for the value
If you have any other idea, that would be great
That should work. Assuming you are setting an impersonation flag as part of the payload in JWT (https://stackoverflow.com/questions/40435842/custom-payload-with-laravel-jwt), you can also utilize config()
to store it in the configuration.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community