Logging in as another user, to see 'what they see' #4921
-
Hello, I am very impressed with Pocketbase and just switching a production app over to use it. The developer experience is just fantastic. One question: As an admin, can I temporarily login as another user, to test the state of the system as they see it? This requirement doesn't come up frequently, but there are edge-cases where it would be much quicker to just be able to login as another user, to work out how they are seeing the system. And if not, then that's fine too, I can probably build a way to make a new profile with the same data and login in to that instead :) Many thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
I'm not sure that I understand the question. |
Beta Was this translation helpful? Give feedback.
-
Hi there, Let's assume I have an application at 'myexampleapp.com'. Anyone can sign up to this app as a normal user. This step involves creating a password (which I, as admin, for obvious reasons, don't and shouldn't have access to). Let's assume a normal user called john@example.com has registered for the app and is encountering a very specific problem with part of the app involving very specific user data (say, a Stripe customer ID, which can only be associated with john@example.com). Now, sometimes, it would, help me if I could login to myexampleapp.com as myself (being an admin) and then, in some kind of admin section of the app, have the ability to 'login as john@example.com'. Aka generate a correct auth token for John, regardless of whether he entered his password, knowing that I am an admin. I hope this makes a bit more sense, apologies again for the bad initial explanation. |
Beta Was this translation helpful? Give feedback.
Users impersonation is not available at the moment (it will be added sometime in the near future as part of #718).
An example how you could implement it on your own via the
pb_hooks
could be found in #3401 (comment).