[PR #1018] [MERGED] Feature/add client logins with pkce auth flow #13228

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

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/1018
Author: @bcmmbaga
Created: 7/18/2023
Status: Merged
Merged: 7/26/2023
Merged by: @bcmmbaga

Base: feature/add-pkce-authorization-flowHead: feature/add-client-logins-with-pkce-auth-flow


📝 Commits (10+)

  • a54f0f3 refactor device flow into oauth flow
  • f6ba7b1 wip: add pkce authorization flow implementation
  • cbd28d1 wait for pkce authorization token
  • 3cd9f22 wip: fix broken auth flow unit tests
  • 4b1b8f4 add UseIDToken field to PKCE flow config
  • 6dcd2af Merge branch 'feature/add-pkce-authorization-flow' into feature/add-client-logins-with-pkce-auth-flow
  • fbb9d9f refactor pkce authorization flow
  • 74c60d7 initialize PKCE auth flow if no device flow available
  • 4f048c3 fix device flow unit tests
  • e9c0892 do not show userCode for pkce authentication flow

📊 Changes

18 files changed (+754 additions, -497 deletions)

View changed files

📝 client/android/login.go (+7 -18)
📝 client/cmd/login.go (+11 -24)
client/internal/auth/device_flow.go (+202 -0)
📝 client/internal/auth/device_flow_test.go (+16 -15)
client/internal/auth/oauth.go (+88 -0)
client/internal/auth/pkce_flow.go (+213 -0)
client/internal/auth/util.go (+62 -0)
client/internal/oauth.go (+0 -286)
📝 client/internal/pkce_auth.go (+4 -4)
📝 client/server/server.go (+21 -33)
📝 infrastructure_files/base.setup.env (+1 -2)
📝 infrastructure_files/configure.sh (+8 -0)
📝 infrastructure_files/management.json.tmpl (+1 -1)
📝 infrastructure_files/setup.env.example (+6 -0)
📝 management/proto/management.pb.go (+110 -110)
📝 management/proto/management.proto (+2 -2)
📝 management/server/config.go (+1 -1)
📝 management/server/grpcserver.go (+1 -1)

📄 Description

Describe your changes

Enhance the user experience by enabling authentication to Netbird using Single Sign-On (SSO) with any Identity Provider (IDP) provider. Current client offers this capability through the Device Authorization Flow, however, is not widely supported by many IDPs, and even some that do support it do not provide a complete verification URL.

To address these challenges, this pull request enable Authorization Code Flow with Proof Key for Code Exchange (PKCE) for client logins, which is a more widely adopted and secure approach to facilitate SSO with various IDP providers.

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)
  • Extended the README / documentation, if necessary

🔄 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/1018 **Author:** [@bcmmbaga](https://github.com/bcmmbaga) **Created:** 7/18/2023 **Status:** ✅ Merged **Merged:** 7/26/2023 **Merged by:** [@bcmmbaga](https://github.com/bcmmbaga) **Base:** `feature/add-pkce-authorization-flow` ← **Head:** `feature/add-client-logins-with-pkce-auth-flow` --- ### 📝 Commits (10+) - [`a54f0f3`](https://github.com/netbirdio/netbird/commit/a54f0f351b878f95d5f6b22153050f4ff560ec74) refactor device flow into oauth flow - [`f6ba7b1`](https://github.com/netbirdio/netbird/commit/f6ba7b1bb9b249f624667bcc0a90a842b1d98f01) wip: add pkce authorization flow implementation - [`cbd28d1`](https://github.com/netbirdio/netbird/commit/cbd28d1ddefea443fcfb42e92d2d7ffb2d8265cc) wait for pkce authorization token - [`3cd9f22`](https://github.com/netbirdio/netbird/commit/3cd9f221ddfc4e38a2506e35a80a968b22f20fd2) wip: fix broken auth flow unit tests - [`4b1b8f4`](https://github.com/netbirdio/netbird/commit/4b1b8f4337af67fa47edb64f3dec23110d5eff6b) add UseIDToken field to PKCE flow config - [`6dcd2af`](https://github.com/netbirdio/netbird/commit/6dcd2affd665cd0b848398cad2db387838c54ff9) Merge branch 'feature/add-pkce-authorization-flow' into feature/add-client-logins-with-pkce-auth-flow - [`fbb9d9f`](https://github.com/netbirdio/netbird/commit/fbb9d9f098e2d3c9b97b80ebcf441bd1a45b34ab) refactor pkce authorization flow - [`74c60d7`](https://github.com/netbirdio/netbird/commit/74c60d73a7f3e3720ec9f829e4fd5dfc60a3332b) initialize PKCE auth flow if no device flow available - [`4f048c3`](https://github.com/netbirdio/netbird/commit/4f048c3aebfa7643d1578547122f2cb54cbfc256) fix device flow unit tests - [`e9c0892`](https://github.com/netbirdio/netbird/commit/e9c08925773070f3a07cf82a468c8f9b9968b942) do not show userCode for pkce authentication flow ### 📊 Changes **18 files changed** (+754 additions, -497 deletions) <details> <summary>View changed files</summary> 📝 `client/android/login.go` (+7 -18) 📝 `client/cmd/login.go` (+11 -24) ➕ `client/internal/auth/device_flow.go` (+202 -0) 📝 `client/internal/auth/device_flow_test.go` (+16 -15) ➕ `client/internal/auth/oauth.go` (+88 -0) ➕ `client/internal/auth/pkce_flow.go` (+213 -0) ➕ `client/internal/auth/util.go` (+62 -0) ➖ `client/internal/oauth.go` (+0 -286) 📝 `client/internal/pkce_auth.go` (+4 -4) 📝 `client/server/server.go` (+21 -33) 📝 `infrastructure_files/base.setup.env` (+1 -2) 📝 `infrastructure_files/configure.sh` (+8 -0) 📝 `infrastructure_files/management.json.tmpl` (+1 -1) 📝 `infrastructure_files/setup.env.example` (+6 -0) 📝 `management/proto/management.pb.go` (+110 -110) 📝 `management/proto/management.proto` (+2 -2) 📝 `management/server/config.go` (+1 -1) 📝 `management/server/grpcserver.go` (+1 -1) </details> ### 📄 Description ## Describe your changes Enhance the user experience by enabling authentication to Netbird using Single Sign-On (SSO) with any Identity Provider (IDP) provider. Current client offers this capability through the Device Authorization Flow, however, is not widely supported by many IDPs, and even some that do support it do not provide a complete verification URL. To address these challenges, this pull request enable Authorization Code Flow with Proof Key for Code Exchange (PKCE) for client logins, which is a more widely adopted and secure approach to facilitate SSO with various IDP providers. ## Issue ticket number and link ### 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) - [ ] Extended the README / documentation, if necessary --- <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 02:07:50 -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#13228