This plugin works fine https://github.com/404labfr/laravel-impersonate but I am developing a web application that performs a RESTful API. APIs typically use tokens to authenticate users and do not maintain session state between requests.
And larave-impersonation plugin https://github.com/404labfr/laravel-impersonate is session based, which can be done in routes/controllers that belongs to the web middleware group. It’s because API routes are stateless, they are using API tokens and not a session for authentication and authorization. So basically I cannot use this handy plugin :(
Is there a way to perform user impersonation using API tokens?
User impersonation feature has an ability to impersonate other users. As an admin you can view all screens as if you are logged in as another user. This allows you to easily spot a problem that your user might be reporting.