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

chore: improve authentication handling #2398

Merged
merged 1 commit into from
Jan 24, 2025
Merged

chore: improve authentication handling #2398

merged 1 commit into from
Jan 24, 2025

Conversation

digitalcora
Copy link
Contributor

@digitalcora digitalcora commented Jan 13, 2025

Using the admin UI was previously plagued by auth errors that would occur after just a few minutes of idle time and required refreshing the page, losing any work in progress.

These changes should improve how we handle authentication, allowing an admin to be idle for up to 30 minutes and signed in for up to 12 hours before needing to reauthenticate, following the TID Session Management guidelines and the prior art of mbta/screenplay#520.

This also revises and unifies how data fetching works in the admin UI, to allow showing admins a message indicating their session has expired when that happens (regardless of the interaction), rather than a generic error message.

In support of the above feature being able to distinguish HTML page requests from API requests, this also disentangles some pipelines in the router where some API endpoints were piped through both "browser" and "api", causing their format to be improperly set as HTML.

Asana task: https://app.asana.com/0/0/1209132981413564

@digitalcora digitalcora force-pushed the cfg-auth-updates branch 2 times, most recently from ccca90d to 68b6378 Compare January 23, 2025 19:19
@digitalcora digitalcora marked this pull request as ready for review January 23, 2025 19:29
@digitalcora digitalcora requested a review from a team as a code owner January 23, 2025 19:29
@digitalcora digitalcora force-pushed the cfg-auth-updates branch 2 times, most recently from 409930c to edc3cb1 Compare January 24, 2025 16:02
Copy link
Collaborator

@panentheos panentheos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See small comment, otherwise looks good!

assets/src/util/admin.tsx Outdated Show resolved Hide resolved
Using the admin UI was previously plagued by auth errors that would
occur after just a few minutes of idle time and required refreshing the
page, losing any work in progress.

These changes should improve how we handle authentication, allowing an
admin to be idle for up to 30 minutes and signed in for up to 12 hours
before needing to reauthenticate, following the TID Session Management
guidelines and the prior art of mbta/screenplay#520.

This also revises and unifies how data fetching works in the admin UI,
to allow showing admins a message indicating their session has expired
when that happens (regardless of the interaction), rather than a generic
error message.

In support of the above feature being able to distinguish HTML page
requests from API requests, this _also_ disentangles some pipelines in
the router where some API endpoints were piped through both "browser"
and "api", causing their format to be improperly set as HTML.
@digitalcora digitalcora merged commit d9a86bb into main Jan 24, 2025
12 checks passed
@digitalcora digitalcora deleted the cfg-auth-updates branch January 24, 2025 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants