Support the ongoing development of Laravel.io →
posted 2 years ago
Last updated 1 year ago.
0

Hello,

I'd like to help, but need to know first – how the impersonation is implemented?

0

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

0

That should work. Assuming you are setting an impersonation flag as part of the payload in JWT (https://stackoverflow.com/questions/40435842/custom-payload-wi...), you can also utilize config() to store it in the configuration.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

trbsi trbsi Joined 3 May 2017

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.