FastAPI Auth Middleware for [Clerk](https://clerk.com)
Project description
FastAPI Clerk Auth Middleware
FastAPI Auth Middleware for Clerk
Install
pip install fastapi-clerk
Basic Usage
from fastapi import FastAPI, Depends
from fastapi_clerk_auth import ClerkConfig, ClerkHTTPBearer, HTTPAuthorizationCredentials
from fastapi.responses import JSONResponse
from fastapi.encoders import jsonable_encoder
app = FastAPI()
clerk_config = ClerkConfig(jwks_url="https://example.com/.well-known/jwks.json") # Use your Clerk JWKS endpoint
clear_auth_guard = ClerkHTTPBearer(config=clerk_config)
@app.get("/")
async def read_root(credentials: HTTPAuthorizationCredentials | None = Depends(clear_auth_guard)):
return JSONResponse(content=jsonable_encoder(credentials))
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
Built Distribution
Close
Hashes for fastapi_clerk_auth-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f0e874697cb574747bfff07ff91e87ac5f9efc2b1957c9f8e056f3c99cbaa9a |
|
MD5 | e8e05c029039d70c7e9b1844c2fe07d2 |
|
BLAKE2b-256 | c59639d04692207e905f6a6be60808105397b665ee345327206bc729a3d84d75 |