Skip to content

Show login popup or redirect to OAuth provider when session token has expired#4000

Merged
tillprochaska merged 1 commit intorelease/4.1.0from
fix/3999-ui-session-expired
Nov 19, 2024
Merged

Show login popup or redirect to OAuth provider when session token has expired#4000
tillprochaska merged 1 commit intorelease/4.1.0from
fix/3999-ui-session-expired

Conversation

@tillprochaska
Copy link
Contributor

@tillprochaska tillprochaska commented Nov 12, 2024

Fixes #3999.

This is related to #3948 in which I fixed the infinite request loop in case requests to the metadata API fail. This works as intended, but has one unintended side effect: We were actually kind of relying on the previous behavior to handle expired session tokens.

For context: When a user logs in, the session token is stored. When the session token expires, future API requests using that session token will obviously fail. The UI was previously handling 401 response codes to invalidate the stored session token and display a login popup or redirect to the OAuth service.

The change introduced in #3948 also prevented the handling of requests that failed to expired session tokens. I’m not convinced that this way of handling expired session tokens is a good solution as it’s pretty opaque.

So with this change, we will keep the newly introduced behavior (which shows an error message and a "Retry" button) in case a request to the metadata API fails, except if it failed with a 401 response in which case we still do whatever happened before.

How to test this

  1. Check out the develop branch or the 4.1.0-rc1 tag.
  2. Follow steps to reproduce the issue from BUG: Error message displayed when session token has expired #3999.
  3. Now check out this branch again and try to reproduce the issue again.

Fixes #3999.

This is related to #3948 in which I fixed the infinite request loop in case requests to the metadata API fail. This works as intended, but has one unintended side effect: We were actually kind of relying on the previous behavior to handle expired session tokens.

For context: When a user logs in, the session token is stored. When the session token expires, future API requests using that session token will obviously fail. The UI was previously handling 401 response codes to invalidate the stored session token and display a login popup or redirect to the OAuth service.

The change introduced in #3948 also prevented the handling of requests that failed to expired session tokens. I’m not convinced that this way of handling expired session tokens is a good solution as it’s pretty opaque.

So with this change, we will keep the newly introduced behavior (which shows an error message and a "Retry" button) in case a request to the metadata API fails, *except* if it failed with a 401 response in which case we still do whatever happened before.
@tillprochaska tillprochaska force-pushed the fix/3999-ui-session-expired branch from 2785307 to 348434c Compare November 12, 2024 17:56
@tillprochaska tillprochaska changed the title Do not handle 401/auth errors in router Show login popup or redirect to OAuth provider when session token has expired Nov 12, 2024
Copy link
Contributor

@stchris stchris left a comment

Choose a reason for hiding this comment

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

Works as expected! Thanks for catching and fixing this! 🙏

@tillprochaska tillprochaska merged commit 6a28fcf into release/4.1.0 Nov 19, 2024
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