Skip to content

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

Closed as not planned
Closed as not planned

Description

@ojeytonwilliams

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 [email protected] as their email address
  3. Api responds, setting the access token cookie jwt_access_token to allow access to the [email protected] account

This means changing accounts is a convoluted process:

  1. Modify the database so that a different user has the [email protected] 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.

Activity

  1. converted this from a draft issue on May 13, 2024
  2. added
    platform: api
    on May 20, 2024
  3. added
    status: discussing
    on Jan 30, 2025
  4. Nirajn2311 commented on Jan 30, 2025

    @Nirajn2311
    Member

    I think the first method, creating a dev signin, is the simpler approach and this way we can login as any user for development and the tests. Also we won't have to make any major modifications in the UI as when we go the way of decoupling the frontend with the API with respect to auth there won't be any changes needed to be done here other than a "if" check

  5. jdwilkin4 commented on Nov 21, 2025

    @jdwilkin4
    Contributor

    As discussed in the staff chat, I am closing this due to inactivity.

    If you wish to reopen it and work on, then feel free to reopen 👍🏾

  6. moved this from Discussing to Done in Backend APIon Nov 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    platform: apistatus: discussing

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions