Skip to main content

FastAPI Auth OpenID Connect

Project description

FastAPI OIDC Security

This library allows your server-side application to check credentials with ease using OpenID Connect token flows. Use it with Firebase, Keycloak, Authentik or other OIDC providers.

Simple usage

from fastapi import FastAPI
from fastapi_auth_oidc import OIDCProvider, IDToken

app = FastAPI()
auth_user = OIDCProvider(
    configuration_uri="https://example.domain/issuer/.well-known/openid-configuration",
    client_id="my-client",
)

@app.get("/me")
def get_me(
    user: Annotated[IDToken | None, Depends(auth_user)],
):
    return user.model_dump() if user else {}

You must process errors and absent token manually!

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

fastapi_auth_oidc-0.1.4.tar.gz (44.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fastapi_auth_oidc-0.1.4-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file fastapi_auth_oidc-0.1.4.tar.gz.

File metadata

  • Download URL: fastapi_auth_oidc-0.1.4.tar.gz
  • Upload date:
  • Size: 44.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for fastapi_auth_oidc-0.1.4.tar.gz
Algorithm Hash digest
SHA256 fea69c5d5eb93184cbb49897f49ec508c3d23609afbc234c780fea3e6bdfa4cb
MD5 227c30e78cef739454505931dbd51819
BLAKE2b-256 37e4bd78fdd1881b9d29f035d0fb579c04307266fe901b13f678272a0cfe34b8

See more details on using hashes here.

File details

Details for the file fastapi_auth_oidc-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for fastapi_auth_oidc-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 596aa2a9e61102e2389aa45c222cd538bc1705337d246da5aacd3d6b6b8b303d
MD5 b14f7144664595196d400296e1633860
BLAKE2b-256 be5e33891cf20fb24a6dff0d9d1ae9b87c96b97ecee5431c15ffd9c075238e14

See more details on using hashes here.

Supported by

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