feat(cli): support OIDC device authorization grant for headless login - #2795
Open
jhjaggars wants to merge 4 commits into
Open
feat(cli): support OIDC device authorization grant for headless login#2795jhjaggars wants to merge 4 commits into
jhjaggars wants to merge 4 commits into
Conversation
Closes NVIDIA#2793 Add OAuth 2.0 Device Authorization Grant (RFC 8628) support to the OpenShell CLI's OIDC login flow. When running in a headless environment (OPENSHELL_NO_BROWSER=1) without a client secret configured, the CLI now uses the device code flow instead of the browser-based PKCE flow. The device code flow: - Requests a device code and user code from the IdP's device authorization endpoint - Displays a verification URL and user code to the user - Polls the token endpoint until the user completes authorization or the code expires - Supports slow_down responses per RFC 8628 by increasing the polling interval This implementation: - Extends OidcDiscovery to optionally capture device_authorization_endpoint - Adds oidc_device_code_flow function with proper error handling for all RFC 8628 error codes - Updates gateway add and gateway login to dispatch to device flow when browser is suppressed - Adds comprehensive unit tests for device flow structs and response parsing - Updates gateway authentication documentation to describe the device code fallback Signed-off-by: Jesse Jaggars <jjaggars@redhat.com>
Signed-off-by: Jesse Jaggars <jjaggars@redhat.com>
jhjaggars
marked this pull request as ready for review
August 18, 2026 23:09
jhjaggars
requested review from
a team,
derekwaynecarr,
mrunalp and
sjenning
as code owners
August 18, 2026 23:09
Signed-off-by: Jesse Jaggars <jjaggars@redhat.com>
Signed-off-by: Jesse Jaggars <jjaggars@redhat.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add OAuth 2.0 Device Authorization Grant (RFC 8628) support so operators can authenticate interactively against OIDC-secured gateways from headless environments without a local browser or confidential client secret.
Related Issue
Closes #2793
Changes
device_authorization_endpointOPENSHELL_NO_BROWSER=1and no client secret is configuredauthorization_pending,slow_down,access_denied, andexpired_tokenresponsesTesting
mise run pre-commitpassescargo test -p openshell-cli oidcpasses (27 tests)whoamiagainst an OIDC-secured OpenShell gatewayChecklist