An open API service indexing awesome lists of open source software.

https://github.com/alan2207/epic-stack-with-user-impersonation

An example Remix application showcasing how to implement user impersonation in the Epic Stack.
https://github.com/alan2207/epic-stack-with-user-impersonation

epic-stack epic-stack-example remix user-impersonate

Last synced: 11 months ago
JSON representation

An example Remix application showcasing how to implement user impersonation in the Epic Stack.

Awesome Lists containing this project

README

          

# Epic Stack with User Impersonation

User impersonation is a feature that allows admin users to log in as any other
user without knowing their password. This is useful for troubleshooting issues
that a user may be experiencing.

This example demonstrates how to implement this feature in an Epic Stack application.

## Demo:

![Demo](./demo.gif)

## How it works

When an admin user wants to impersonate another user, we need to:

- Get the current session ID from the cookie and store it in the session as
`impersonatorSessionId`
- Create a new session for the user we want to impersonate and store it in the
cookie as `sessionId`

When the user stops impersonating, we need to:

- Take the session ID stored in `impersonatorSessionId` and assign it to
`sessionId`, which will restore the original admin session.
- Clear `impersonatorSessionId` from the cookie