Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow users + tests to sign in to multiple users #54751

Open
ojeytonwilliams opened this issue May 13, 2024 · 0 comments
Open

Allow users + tests to sign in to multiple users #54751

ojeytonwilliams opened this issue May 13, 2024 · 0 comments
Labels
platform: api Server application that needs familiarity with Express, Loopback, MongoDB etc.

Comments

@ojeytonwilliams
Copy link
Contributor

ojeytonwilliams commented May 13, 2024

Currently the development sign in process works like this:

  1. Client makes a request to API_LOCATION/signin
  2. Api looks up the user with foo@bar.com as their email address
  3. Api responds, setting the access token cookie jwt_access_token to allow access to the foo@bar.com account

This means changing accounts is a convoluted process:

  1. Modify the database so that a different user has the foo@bar.com email address (e.g. use pnpm seed:certified-user)
  2. Delete the jwt_access_token cookie
  3. Sign in again

The main benefit of this is that it's quick to get started. As a contributor, I only need to click on the "Sign in" button and I'm in.

Handling multiple accounts

I propose we modify the learn client and server to allow the client to change user without the contributor having to directly modify the database (no need to seed). To do this we could:

  • Create a dev-only POST endpoint, /dev-signin, that accepts a payload of { email: string } and signs you in to that user, if they exist
  • Create a dev-only page on the client that provides a simple UI to make those requests.

A simple dropdown with a submit button should be enough. If the developmentuser is selected by default, then signing in is still pretty quick. The only addition is that you'd have to press enter when you arrive on the sign in page.

@gikf gikf added the platform: api Server application that needs familiarity with Express, Loopback, MongoDB etc. label May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: api Server application that needs familiarity with Express, Loopback, MongoDB etc.
Projects
Status: Discussing
Development

No branches or pull requests

2 participants