Skip to content

fix(auth): issue with token expiration - #2727

Merged
rmnbrd merged 2 commits into
stagingfrom
fix/401-redirect-issue
Jun 2, 2026
Merged

fix(auth): issue with token expiration#2727
rmnbrd merged 2 commits into
stagingfrom
fix/401-redirect-issue

Conversation

@rmnbrd

@rmnbrd rmnbrd commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Issue: Slack thread

When the auth token expires, rather than being redirected to the login page, we were displaying a "Something went wrong!" error message. This PR fixes this issue.

Screenshots / Recordings

Testing

  • Changes tested locally in the relevant Console's pages and Storybooks
  • yarn test or yarn test -u (if you need to regenerate snapshots)
  • yarn format
  • yarn lint

PR Checklist

  • I followed naming, styling, and TypeScript rules (see .cursor/rules)
  • I performed a self-review (diff inspected, dead code removed)
  • I titled the PR using Conventional Commits with a scope when possible (e.g. feat(service): add new Terraform service) - required for semantic-release
  • I only kept necessary comments, written in English (watch for useless AI comments)
  • I involved a designer to validate UI changes if I am not a designer
  • I covered new business logic with tests (unit)
  • I confirmed CI is green (Codecov red can be accepted)
  • I reviewed and executed locally any AI-assisted code

@rmnbrd rmnbrd self-assigned this Jun 1, 2026
@rmnbrd
rmnbrd marked this pull request as ready for review June 1, 2026 14:43
Copilot AI review requested due to automatic review settings June 1, 2026 14:43
@codecov

codecov Bot commented Jun 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 70.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 45.71%. Comparing base (f2b2e5e) to head (7987483).

Files with missing lines Patch % Lines
...interceptors/auth-interceptor/auth-interceptor.tsx 70.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           staging    #2727      +/-   ##
===========================================
- Coverage    45.92%   45.71%   -0.21%     
===========================================
  Files         1194     1118      -76     
  Lines        24964    23787    -1177     
  Branches      7316     7040     -276     
===========================================
- Hits         11464    10874     -590     
+ Misses       11515    11037     -478     
+ Partials      1985     1876     -109     
Flag Coverage Δ
unittests 45.71% <70.00%> (-0.21%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes expired/invalid auth token handling so the Console redirects to /login (with a redirect return path) instead of surfacing a generic error.

Changes:

  • Added login redirect URL builder + redirect helper in the auth Axios interceptor.
  • Redirects to login when silent token renewal fails and when API responses return 401.
  • Expanded unit tests around interceptor behavior and redirect URL construction.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
libs/shared/utils/src/lib/http/interceptors/auth-interceptor/auth-interceptor.tsx Add redirect-to-login behavior on token renewal failure and 401 responses; introduce redirect URL helper.
libs/shared/utils/src/lib/http/interceptors/auth-interceptor/auth-interceptor.spec.ts Update tests for interceptor URL/header behavior and add coverage for redirect URL building.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@rmnbrd
rmnbrd force-pushed the fix/401-redirect-issue branch from ad64660 to aae8673 Compare June 1, 2026 19:58
@rmnbrd
rmnbrd requested a review from RemiBonnet June 2, 2026 09:50
@rmnbrd
rmnbrd merged commit 95d7c73 into staging Jun 2, 2026
12 checks passed
@rmnbrd
rmnbrd deleted the fix/401-redirect-issue branch June 2, 2026 11:24
@RemiBonnet

Copy link
Copy Markdown
Member

🎉 This PR is included in version 1.311.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants