oidc-auth-client
Pure python implementation of an OIDC client
Dependencies:
Installing
pip install oidc-auth-client
Example usage
Authorization Code Flow
Use this flow when your application needs to authenticate a real user.
It will:
- Open the user’s browser
- Redirect them to your identity provider’s login page
- Wait for the user to authenticate
- Receive an authorization code
- Exchange it for an access token
Best for CLIs, desktop apps, and tools acting on behalf of a user.
from oidc_auth_client import Config, AuthorizationCode, OidcProvider
config = Config(
client_id="<your-client-id>",
oidc_provider=OidcProvider(
openid_configuration_url="<auth-provider-url>/.well-known/openid-configuration"
)
)
# Sign in with the identity provider in the opened browser!
access_token = AuthorizationCode(config=config).get_token()
Client Credentials Flow
Use this flow when your application needs to authenticate as itself, without user interaction.
The client exchanges its own client_id and client_secret directly for an access token.
Ideal for:
- Backend services
- Server-to-server APIs
- Cron jobs
- Automated tasks
from oidc_auth_client import ClientCredentials, OidcProvider, TokenCache
from oidc_auth_client.client_credentials import ClientCredentialsConfig
config = ClientCredentialsConfig(
client_id=CLIENT_ID,
client_secret=CLIENT_SECRET,
oidc_provider=OidcProvider(openid_configuration_url=OPENID_CONFIGURATION_URL),
)
access_token = ClientCredentials(config=config).get_token()
Token caching between runs
To allow the user to cache the token between usages, configure with a TokenCache. Will store the token in plaintext on the users system.
from oidc_auth_client import Config, TokenCache
config = Config(
# ...
token_cache=TokenCache(),
)
see some example usage in the examples folder.
Contributing
Requirements:
- uv ^0.7.22
Setup:
uv sync
Run tests:
uv run pytest .
Metadata
Release files for oidc-auth-client 0.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| oidc_auth_client-0.1.8.tar.gz | 14.1 kB | Without provenance | Details for oidc_auth_client-0.1.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| oidc_auth_client-0.1.8-py3-none-any.whl | Python 3 | none | any | Details for oidc_auth_client-0.1.8-py3-none-any.whl |
Total release size: 25.2 kB
Release files / oidc_auth_client-0.1.8.tar.gz
| Download URL | oidc_auth_client-0.1.8.tar.gz |
|---|---|
| Size | 14.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0c095aa2552ff28e8d93094900c0ef60bb066d25fbbc4e5119687af2d83a6e73
|
|
BLAKE2b-256 checksum How to use checksums |
dcef609c83ede7fce2ff85bbc008215b0769564bcf7e088a1316dbf4395c262e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / oidc_auth_client-0.1.8-py3-none-any.whl
| Download URL | oidc_auth_client-0.1.8-py3-none-any.whl |
|---|---|
| Size | 11.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5e99c3862edbd2b34adcfa324fa1737b19e6fbbdc0dcd0b159e451c141615bd2
|
|
BLAKE2b-256 checksum How to use checksums |
726343a433636f1ed3d872c6cb384c76eaeeb03c72d4e190988e9fe53da93295
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for oidc-auth-client 0.1.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.