Skip to main content

Obtain authentication tokens from OIDC providers.

Project description

oidcish

  • "Oh I Don't Care If Something Happens"
  • "OIDC Is Definitely Cool If Someone Helps"

What?

Library to connect to your OIDC provider via:

  • Authentication code flow
  • Device code flow
  • Client credentials flow

Usage

>>> from oidcish import DeviceFlow, CodeFlow, CredentialsFlow
>>> auth = DeviceFlow(
...     host="https://idp.example.com",
...     client_id=...,
...     client_secret=...,
...     scope=...,
...     audience=...
...)
Visit https://idp.example.com/device?userCode=594658190 to complete sign-in.
# Or use env file for auth
# auth = DeviceFlow(_env_file="path/to/my/env.file")
# Or use authorization code flow
# auth = CodeFlow(_env_file="path/to/my/env.file")
# Or use client credentials flow
# auth = CredentialsFlow(_env_file="path/to/my/env.file")
>>> print(auth.credentials.access_token)
eyJhbGciOiJSU...

Options

Device flow can be used with the following options:

Option Environment variable Default Description
host OIDCISH_HOST No default The address to the IDP server.
client_id OIDCISH_CLIENT_ID No default The client id.
client_secret OIDCISH_CLIENT_SECRET No default The client secret.
scope OIDCISH_SCOPE openid profile offline_access A space separated, case-sensitive list of scopes.
audience OIDCISH_AUDIENCE No default The access claim was designated for this audience.

The OIDCISH_ prefix can be set with the OIDCISH_ENV_PREFIX environment variable.

Code flow can be used with the following options:

Option Environment variable Default Description
host OIDCISH_HOST No default The address to the IDP server.
client_id OIDCISH_CLIENT_ID No default The client id.
client_secret OIDCISH_CLIENT_SECRET No default The client secret.
redirect_uri OIDCISH_REDIRECT_URI http://localhost Must exactly match one of the allowed redirect URIs for the client.
username OIDCISH_USERNAME No default The user name.
password OIDCISH_PASSWORD No default The user password.
scope OIDCISH_SCOPE openid profile offline_access A space separated, case-sensitive list of scopes.
audience OIDCISH_AUDIENCE No default The access claim was designated for this audience.

The OIDCISH_ prefix can be set with the OIDCISH_ENV_PREFIX environment variable.

Client credentials flow can be used with the following options:

Option Environment variable Default Description
host OIDCISH_HOST No default The address to the IDP server.
client_id OIDCISH_CLIENT_ID No default The client id.
client_secret OIDCISH_CLIENT_SECRET No default The client secret.
audience OIDCISH_AUDIENCE No default The access claim was designated for this audience.

The OIDCISH_ prefix can be set with the OIDCISH_ENV_PREFIX environment variable.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

oidcish-1.0.3.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

oidcish-1.0.3-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file oidcish-1.0.3.tar.gz.

File metadata

  • Download URL: oidcish-1.0.3.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.10 Linux/5.10.102.1-microsoft-standard-WSL2

File hashes

Hashes for oidcish-1.0.3.tar.gz
Algorithm Hash digest
SHA256 b415466199731da06c3cc043a67dfacc3d9221bdd87c8ed44a325f68757a49e6
MD5 ea0dbd022135bd52ffbc614053ae534e
BLAKE2b-256 88748b9813658d37a253bbf4df43aa02d37b7e821dff93720ddfdacee2d76cf3

See more details on using hashes here.

File details

Details for the file oidcish-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: oidcish-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.10 Linux/5.10.102.1-microsoft-standard-WSL2

File hashes

Hashes for oidcish-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 382298035ef5ddfc5994ab0e49da074339cc57b39520fb8cf4ed99ddf1fe1dbe
MD5 dd81efb86e41d113a97c19bea343d20b
BLAKE2b-256 9cd0d380708bcc8b18a48d191c7fd0e7bd7b1bc1def67a385c35a7366cf5d6f2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page