Skip to content

feat: keep original token refresh error in external auth #19339

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Emyrk
Copy link
Member

@Emyrk Emyrk commented Aug 13, 2025

External auth refresh errors lose the original error thrown on the first refresh. This PR saves that error to the database to be raised on subsequent refresh attempts

Addresses: #18811

The issue assumed refresh tokens were being tossed for temporary issues (like an IdP being down). We have code to handle this, however the original error being lost made that code invisible. By keeping the original error, now the reason for the token being invalid is saved (assuming it is a refresh error).

Error now

Screenshot From 2025-08-13 10-48-20 Screenshot From 2025-08-13 10-48-05

Before

This is the behavior before. The first time this failure occurs, it is raised. Subsequent errors always show Error: token expired, refreshing is either disabled or refreshing failed and will not be retried. This subsequent error makes it difficult to debug the original cause.

Screencast.From.2025-08-13.10-29-11.webm

Future work

The error could be better formatted. This PR does not attempt to update the error format, it just retains the first error message.

External auth refresh errors lose the original error thrown on the
first refresh. This PR saves that error to the database to be raised
on subsequent refresh attempts
@Emyrk Emyrk marked this pull request as ready for review August 13, 2025 16:59
Copy link
Member

@aslilac aslilac left a comment

Choose a reason for hiding this comment

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

mostly makes sense to me, though I'm not very familiar with external auth stuff. might be worth waiting to see if someone else comes along to review.

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