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
Justin
Justin2mo ago
You can check the impersonatedBy field on the session. See the admin plugin schema: https://www.better-auth.com/docs/plugins/admin#schema
Admin | Better Auth
Admin plugin for Better Auth

Did you find this page helpful?