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.3.tar.gz (36.6 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.3-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fastapi_auth_oidc-0.1.3.tar.gz
  • Upload date:
  • Size: 36.6 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.3.tar.gz
Algorithm Hash digest
SHA256 581a3eea2b7caf12da632d9caf642b33c5ebe5696e8e5d193576903f71e27297
MD5 da39fa2dd2745874e099b685753a5fb3
BLAKE2b-256 455b2d20dc69925d9dfeb1127d3b4be95238f72d949a0cbbc70ebd0b5d7d0001

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fastapi_auth_oidc-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 baae1fb50b32e64b6022d0fdb4a4fd65e3382f3b077b97404d5df2cb5cdc2cc4
MD5 72a84646b758a8ebdb6b1bfe1b8deaba
BLAKE2b-256 3feed9e5dc37d7335776bfb6960f911573c3694653fb6ca2ae305f0f4991c795

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