Skip to content

Redirect to login page after failing to refresh access token#706

Open
guillegalor wants to merge 1 commit into
jenkinsci:masterfrom
guillegalor:guillegalor/feature/redirect_to_login_on_token_refresh_failure
Open

Redirect to login page after failing to refresh access token#706
guillegalor wants to merge 1 commit into
jenkinsci:masterfrom
guillegalor:guillegalor/feature/redirect_to_login_on_token_refresh_failure

Conversation

@guillegalor
Copy link
Copy Markdown

This PR changes the default behaviour when the refresh of an access token fails. Previously, only 'error=invalid_grant' triggered a login redirect. All other cases sent an HTTP error, shown below:

image

This is a problem when the refresh token expires (or becomes invalid for some other reason) before the jenkin session does.

Testing done

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

@guillegalor guillegalor requested a review from a team as a code owner February 5, 2026 14:01
@guillegalor
Copy link
Copy Markdown
Author

guillegalor commented Feb 5, 2026

I don't know much Java so the only check I did was running the whole test suite and checking that everything passes, I'm happy to do any more testing if necessary.

Sry for the incovenience and thanks

Copy link
Copy Markdown
Contributor

@michael-doubez michael-doubez left a comment

Choose a reason for hiding this comment

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

Did you try it ?

I'd prefer a robust way to identify expired token and redirect rather than hiding other potential errors.

And it the code looks like that, the redirect and return part can be moved to the end of the function.

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