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

Merged
merged 5 commits into from
Aug 14, 2025

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.

@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.

Emyrk added 5 commits August 14, 2025 09:22
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 force-pushed the stevenmasley/refresh_error_raise branch from cccd7ae to b0a1694 Compare August 14, 2025 14:23
@Emyrk Emyrk merged commit 4926410 into main Aug 14, 2025
49 of 52 checks passed
@Emyrk Emyrk deleted the stevenmasley/refresh_error_raise branch August 14, 2025 14:50
@github-actions github-actions bot locked and limited conversation to collaborators Aug 14, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants