Skip to content

Conversation

@davebelais
Copy link
Collaborator

@davebelais davebelais commented Jan 6, 2026

This pull request enhances the handling of OAuth2 and OpenID Connect (OIDC) authentication in the oapi client library, making it easier to configure and automatically discover token endpoints from OIDC provider metadata. The most significant changes include setting a sensible default for the OpenID Connect configuration URL, dynamically retrieving the OAuth2 token endpoint from OIDC metadata, and refactoring related utility methods for clarity and correctness.

Authentication and OIDC Improvements:

  • The open_id_connect_url parameter in the client is now set by default to ".well-known/openid-configuration", making OIDC discovery automatic unless explicitly overridden.
  • The client now attempts to fetch the OAuth2 token endpoint dynamically from the OIDC configuration URL if it is not explicitly provided, improving compatibility with OIDC providers. [1] [2]
  • Updated the docstring for open_id_connect_url to clarify its usage and link to the OIDC discovery specification.

Refactoring and Code Quality:

  • Refactored the _get_oauth2_token_url and _get_open_id_connect_url methods for clarity, removing redundant variables and ensuring correct logic for finding token URLs and OIDC configuration endpoints. [1] [2] [3]
  • Improved imports in client.py by grouping and adding urljoin to support relative OIDC configuration URLs.

Versioning:

  • Bumped the library version to 2.5.0 to reflect these new features and improvements.

@davebelais davebelais merged commit 20529c9 into main Jan 6, 2026
13 checks passed
@davebelais davebelais deleted the oidc branch January 6, 2026 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants