[PR #6717] [MERGED] [client] Add SSO login flow timing instrumentation #28832

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

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/6717
Author: @mlsmaycon
Created: 7/10/2026
Status: Merged
Merged: 7/10/2026
Merged by: @mlsmaycon

Base: mainHead: add-sso-login-timing-logs


📝 Commits (1)

  • 7c99200 [client] Add SSO login flow timing instrumentation

📊 Changes

6 files changed (+60 additions, -1 deletions)

View changed files

📝 client/internal/auth/device_flow.go (+9 -0)
📝 client/internal/auth/pkce_flow.go (+11 -1)
📝 client/server/server.go (+2 -0)
📝 client/ui/frontend/src/app.tsx (+3 -0)
client/ui/frontend/src/lib/stallwatch.ts (+31 -0)
📝 client/ui/services/connection.go (+4 -0)

📄 Description

Describe your changes

Users reported long delays between finishing browser SSO authentication and the client connecting. The existing logs could not attribute the time: the PKCE and device flows were silent between issuing the auth URL and returning the token, and nothing recorded when the GUI issued Up after WaitSSOLogin completed.

This adds timing log lines across the login chain:

  • PKCE flow: callback wait start, IdP callback arrival, token exchange duration
  • Device flow: polling interval, slow_down handling, approval timing (polls + elapsed)
  • GUI (Go side): brackets around Login, WaitSSOLogin, and Up requests
  • Daemon: Up RPC arrival (before the handler mutex) and WaitSSOLogin success return
  • Frontend: a stall detector that reports when webview timers were suspended (macOS App Nap / hidden-window throttling), which delays the WaitSSOLogin → Up handoff

Log-only change, no behavior modified.

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)
  • This change does not modify the public API, gRPC protocols, functionality behavior, CLI / service flags, or introduce a new feature — OR I have discussed it with the NetBird team beforehand (link the issue / Slack thread in the description). 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 (log-only diagnostics, no user-facing behavior change)

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

  • Improvements
    • Added detailed progress logging throughout device authorization, PKCE authentication, SSO login, and connection startup flows.
    • Authentication logs now include polling activity, timeout and redirect details, completion status, and token exchange duration.
    • Added clearer visibility into requests sent between the client and daemon without changing existing behavior.

🔄 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/6717 **Author:** [@mlsmaycon](https://github.com/mlsmaycon) **Created:** 7/10/2026 **Status:** ✅ Merged **Merged:** 7/10/2026 **Merged by:** [@mlsmaycon](https://github.com/mlsmaycon) **Base:** `main` ← **Head:** `add-sso-login-timing-logs` --- ### 📝 Commits (1) - [`7c99200`](https://github.com/netbirdio/netbird/commit/7c99200869c9a4e4b9ff141d163aee9852805ed0) [client] Add SSO login flow timing instrumentation ### 📊 Changes **6 files changed** (+60 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `client/internal/auth/device_flow.go` (+9 -0) 📝 `client/internal/auth/pkce_flow.go` (+11 -1) 📝 `client/server/server.go` (+2 -0) 📝 `client/ui/frontend/src/app.tsx` (+3 -0) ➕ `client/ui/frontend/src/lib/stallwatch.ts` (+31 -0) 📝 `client/ui/services/connection.go` (+4 -0) </details> ### 📄 Description ## Describe your changes Users reported long delays between finishing browser SSO authentication and the client connecting. The existing logs could not attribute the time: the PKCE and device flows were silent between issuing the auth URL and returning the token, and nothing recorded when the GUI issued Up after WaitSSOLogin completed. This adds timing log lines across the login chain: - PKCE flow: callback wait start, IdP callback arrival, token exchange duration - Device flow: polling interval, `slow_down` handling, approval timing (polls + elapsed) - GUI (Go side): brackets around Login, WaitSSOLogin, and Up requests - Daemon: Up RPC arrival (before the handler mutex) and WaitSSOLogin success return - Frontend: a stall detector that reports when webview timers were suspended (macOS App Nap / hidden-window throttling), which delays the WaitSSOLogin → Up handoff Log-only change, no behavior modified. ## Issue ticket number and link ## Stack <!-- branch-stack --> ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [x] Is a feature enhancement - [ ] It is a refactor - [ ] Created tests that fail without the change (if possible) - [x] This change does **not** modify the public API, gRPC protocols, functionality behavior, CLI / service flags, or introduce a new feature — **OR** I have discussed it with the NetBird team beforehand (link the issue / Slack thread in the description). See [CONTRIBUTING.md](https://github.com/netbirdio/netbird/blob/main/CONTRIBUTING.md#discuss-changes-with-the-netbird-team-first). > 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 (log-only diagnostics, no user-facing behavior change) ### 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 * **Improvements** * Added detailed progress logging throughout device authorization, PKCE authentication, SSO login, and connection startup flows. * Authentication logs now include polling activity, timeout and redirect details, completion status, and token exchange duration. * Added clearer visibility into requests sent between the client and daemon without changing existing behavior. <!-- 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:07:00 -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#28832