[PR #7055] [MERGED] [client] Fix session expired relogin #29500

Closed
opened 2026-08-05 08:08:11 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/7055
Author: @pappz
Created: 8/4/2026
Status: Merged
Merged: 8/4/2026
Merged by: @pappz

Base: mainHead: fix/session-expired-relogin


📝 Commits (3)

  • 18b1cd4 [client] Route expired-session dialog to full re-login instead of extend
  • ac83d9d [client] Trigger login from the expired tray session row
  • a219b12 [client] Drop dead /#/login navigation from the session-expired handler

📊 Changes

3 files changed (+22 additions, -9 deletions)

View changed files

📝 client/server/server.go (+3 -0)
📝 client/ui/frontend/src/modules/session/SessionExpirationDialog.tsx (+17 -2)
📝 client/ui/tray_session.go (+2 -7)

📄 Description

Describe your changes

After the SSO session expires, the daemon tears the engine down permanently
(management returns PermissionDeniedrunCancel() → the retry loop exits
for good). The "Session expired" dialog's Login button still drove the
extend-session flow, which requires a live engine: the user completed the full
browser SSO + 2FA round trip only to get
Failed to extend the session — engine is not initialised, with no way out
other than quitting and relaunching the client.

Reproduce:

  1. Log in on a desktop client with session expiration enabled (e.g. 16h TTL).
  2. Let the session expire (e.g. leave the machine asleep overnight).
  3. Wake it, click Login on the "Session expired" dialog, complete SSO + 2FA.
  4. The error dialog appears and every retry fails the same way.

Changes:

  • The expired branch of the session-expiration dialog now emits
    trigger-login, driving the full Login → SSO → Up sequence that rebuilds
    the client, instead of the extend flow (an expired session can no longer be
    extended).
  • RequestExtendAuthSession fails fast when the engine is already gone, so the
    browser/2FA round trip is not wasted on a doomed extend.
  • The expired tray row navigated the main window to /#/login, a route that
    does not exist and fell through to the main page without starting a login;
    it now emits trigger-login as well.

Stack

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)
  • I ran and tested this change locally — I did not rely on CI to find out whether it works
  • This PR has a single purpose (not a fix + refactor + feature in one)
  • This change is a trivial fix, OR it links an issue the NetBird team agreed on beforehand. Changes to the public API, gRPC protocols, functionality behavior, CLI / service flags, or new features always need that agreement first. See CONTRIBUTING.md.

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.

Documentation

Select exactly one:

  • I added/updated documentation for this change
  • Documentation is not needed for this change (explain why)

Docs PR URL (required if "docs added" is checked)

Paste the PR link from https://github.com/netbirdio/docs here:

https://github.com/netbirdio/docs/pull/__

Summary by CodeRabbit

  • Bug Fixes
    • Improved session extension handling when the client engine is unavailable by prompting users to log in again.
    • Updated expired-session behavior to trigger the standard login flow, providing a more consistent sign-in experience.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbirdio/netbird/pull/7055 **Author:** [@pappz](https://github.com/pappz) **Created:** 8/4/2026 **Status:** ✅ Merged **Merged:** 8/4/2026 **Merged by:** [@pappz](https://github.com/pappz) **Base:** `main` ← **Head:** `fix/session-expired-relogin` --- ### 📝 Commits (3) - [`18b1cd4`](https://github.com/netbirdio/netbird/commit/18b1cd443e90f7b2e9de1bf67570a469347872df) [client] Route expired-session dialog to full re-login instead of extend - [`ac83d9d`](https://github.com/netbirdio/netbird/commit/ac83d9d50bd514771353aad60ea8aba59fa34a17) [client] Trigger login from the expired tray session row - [`a219b12`](https://github.com/netbirdio/netbird/commit/a219b12e03f0524b211a3f06dfc956b3902937a8) [client] Drop dead /#/login navigation from the session-expired handler ### 📊 Changes **3 files changed** (+22 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `client/server/server.go` (+3 -0) 📝 `client/ui/frontend/src/modules/session/SessionExpirationDialog.tsx` (+17 -2) 📝 `client/ui/tray_session.go` (+2 -7) </details> ### 📄 Description ## Describe your changes After the SSO session expires, the daemon tears the engine down permanently (management returns `PermissionDenied` → `runCancel()` → the retry loop exits for good). The "Session expired" dialog's Login button still drove the extend-session flow, which requires a live engine: the user completed the full browser SSO + 2FA round trip only to get `Failed to extend the session — engine is not initialised`, with no way out other than quitting and relaunching the client. Reproduce: 1. Log in on a desktop client with session expiration enabled (e.g. 16h TTL). 2. Let the session expire (e.g. leave the machine asleep overnight). 3. Wake it, click **Login** on the "Session expired" dialog, complete SSO + 2FA. 4. The error dialog appears and every retry fails the same way. Changes: - The expired branch of the session-expiration dialog now emits `trigger-login`, driving the full `Login → SSO → Up` sequence that rebuilds the client, instead of the extend flow (an expired session can no longer be extended). - `RequestExtendAuthSession` fails fast when the engine is already gone, so the browser/2FA round trip is not wasted on a doomed extend. - The expired tray row navigated the main window to `/#/login`, a route that does not exist and fell through to the main page without starting a login; it now emits `trigger-login` as well. ## Issue ticket number and link <!-- Required for anything that changes behavior. Link the issue (or the validated discussion it came from) that the NetBird team already agreed on. See https://github.com/netbirdio/netbird/blob/main/CONTRIBUTING.md#ticket-first-pr-second --> ## Stack <!-- branch-stack --> ### Checklist - [x] Is it a bug fix - [ ] Is a typo/documentation fix - [ ] Is a feature enhancement - [ ] It is a refactor - [ ] Created tests that fail without the change (if possible) - [ ] I ran and tested this change locally — I did not rely on CI to find out whether it works - [ ] This PR has a single purpose (not a fix + refactor + feature in one) - [ ] This change is a trivial fix, **OR** it links an issue the NetBird team agreed on beforehand. Changes to the public API, gRPC protocols, functionality behavior, CLI / service flags, or new features always need that agreement first. See [CONTRIBUTING.md](https://github.com/netbirdio/netbird/blob/main/CONTRIBUTING.md#ticket-first-pr-second). > By submitting this pull request, you confirm that you have read and agree to the terms of the [Contributor License Agreement](https://github.com/netbirdio/netbird/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT.md). ## Documentation Select exactly one: - [ ] I added/updated documentation for this change - [x] Documentation is **not needed** for this change (explain why) ### Docs PR URL (required if "docs added" is checked) Paste the PR link from https://github.com/netbirdio/docs here: https://github.com/netbirdio/docs/pull/__ <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Improved session extension handling when the client engine is unavailable by prompting users to log in again. - Updated expired-session behavior to trigger the standard login flow, providing a more consistent sign-in experience. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2026-08-05 08:08:11 -04:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#29500