how to check if i'm impersonating an user
basically i want to make an impersonate feature where admins can see the user's dashboard (basically impersonation)
but idk how to check if I as admin am currently impersonating someone.
2 Replies
You can check the
impersonatedBy
field on the session.
See the admin plugin schema: https://www.better-auth.com/docs/plugins/admin#schemaAdmin | Better Auth
Admin plugin for Better Auth
Admin | Better Auth
Admin plugin for Better Auth