[PR #6671] fix(management): refresh user name/email from ID-token claims on login #26631

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

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/6671
Author: @Amilliox
Created: 7/5/2026
Status: 🔄 Open

Base: mainHead: main


📝 Commits (2)

  • 4e0b245 fix(management): refresh user name/email from ID-token claims on login
  • 173f9c1 fix: revert in-memory name/email on SaveUser failure

📊 Changes

1 file changed (+15 additions, -0 deletions)

View changed files

📝 management/server/user.go (+15 -0)

📄 Description

Problem

On subsequent logins, GetUserFromUserAuth only updates last_login but never refreshes name/email from the ID-token claims. Users created by older versions keep empty name/email forever, and those running with IdpManagerConfig.ManagerType: "none" also see blank fields.

Fix

After retrieving the user, check if userAuth.Name or userAuth.Email differ from stored values (and are non-empty). If so, update and save — mirroring the existing JWT group sync (JWTGroupsClaimName) pattern.

Scope

  • 1 file: management/server/user.go
  • +13 lines
  • No new dependencies
  • No config changes
  • No IdP API calls
  • No SCIM/license needed

Fixes #6652
Related #2073

Summary by CodeRabbit

  • Bug Fixes
    • During login, the app now refreshes the stored user profile details (name and/or email) from the latest authentication token claims when available.
    • If updating those saved details fails, login still succeeds and the sign-in flow remains reliable.

🔄 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/6671 **Author:** [@Amilliox](https://github.com/Amilliox) **Created:** 7/5/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (2) - [`4e0b245`](https://github.com/netbirdio/netbird/commit/4e0b24503e6c4ae66543608c200acaf5b14196a7) fix(management): refresh user name/email from ID-token claims on login - [`173f9c1`](https://github.com/netbirdio/netbird/commit/173f9c1a0e38429415028312a06fe25ecf03b5ea) fix: revert in-memory name/email on SaveUser failure ### 📊 Changes **1 file changed** (+15 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `management/server/user.go` (+15 -0) </details> ### 📄 Description ### Problem On subsequent logins, `GetUserFromUserAuth` only updates `last_login` but never refreshes `name`/`email` from the ID-token claims. Users created by older versions keep empty name/email forever, and those running with `IdpManagerConfig.ManagerType: "none"` also see blank fields. ### Fix After retrieving the user, check if `userAuth.Name` or `userAuth.Email` differ from stored values (and are non-empty). If so, update and save — mirroring the existing JWT group sync (`JWTGroupsClaimName`) pattern. ### Scope - 1 file: `management/server/user.go` - +13 lines - No new dependencies - No config changes - No IdP API calls - No SCIM/license needed Fixes #6652 Related #2073 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * During login, the app now refreshes the stored user profile details (name and/or email) from the latest authentication token claims when available. * If updating those saved details fails, login still succeeds and the sign-in flow remains reliable. <!-- 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 07:07:35 -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#26631