Repository navigation
Add OidcBrowserAuth: browser PKCE and device code login for OIDC providers - #52
Merged
TejasRGitHub merged 2 commits intoSep 25, 2026
Merged
Conversation
…iders - Authorization Code + PKCE through the system browser on a loopback redirect URI, device authorization grant when no browser is available, silent renewal with the refresh token - Profile: OidcBrowser auth type, scopes, fallback_redirect_uri, frontend_url - BaseClient sends Origin/Referer from frontend_url for WAF-restricted APIs - AuthenticationException; interactive prompt moved to an overridable hook Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This was referenced Sep 25, 2026
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.
Feature or Bugfix
Detail
OidcBrowserAuthfor deployments that use an external OIDC provider (Okta and similar) with SSO/MFA, whereCustomAuth's username/password to session-token flow cannot be used:redirect_uri, defaulthttp://localhost:8765/callback, optionalfallback_redirect_uriwhen the first port is busy).stateis checked with a constant-time compare; the wait times out after 5 minutes.DATAALL_DEVICE_LOGIN=1, an SSH session withoutDISPLAY, no loopback port available, orwebbrowser.openfailing. Polls the token endpoint honouringintervalandslow_down.openid offline_accessby default). If the provider rejects the requested scopes (invalid_scope, or a policyaccess_denied) the login is retried once withopenidonly.{idp_domain_url}/.well-known/openid-configurationwith the sameauth_serverconvention asCustomAuth. Token requests are form-encoded and includeclient_secretonly when the profile has one, so public clients work.Profile:AuthType.OidcBrowser, optionalscopes,fallback_redirect_uri,frontend_url. Unset fields are not written, so existing Cognito and Custom profiles are unchanged.BaseClientsendsOriginandRefererfromfrontend_urlwhen it is set. Some deployments front the API with a WAF that only accepts requests carrying the web UI origin.custom_headersstill override.AuthorizationClass.get_jwt_tokenis unchanged; the username/password prompt moved into an overridable_authenticate_interactive()hook, soCognitoAuthandCustomAuthbehave exactly as before.AuthenticationExceptioncarrying the provider'serroranderror_description.client_secrethandling, profile round trips,_find_authorizer. Verified manually end to end against an Okta custom authorization server (browser login, API call, forced-expiry refresh).Relates
Security
code,state,erroranderror_descriptionfrom the query string on the configured callback path, validatesstatewithhmac.compare_digest, and answers with a plain-text body (no user input is rendered as HTML). Provider responses are decoded withhttpx's JSON decoder. Noeval, no pickle, no database access.Bearerexactly as the existing auth classes do and are validated by the deployment's API authorizer. Failed logins raiseAuthenticationExceptionwith the provider's error; refresh failures are logged before falling back to an interactive login.secretsfor the verifier and state andhashlib.sha256for the PKCE challenge. No keys are stored; tokens go to the existingcredentials.yamllocation.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
🤖 Generated with Claude Code