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.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f6bbcf58a3b98efe4f3e9dbef95226925dab8e9da43a1696d496c44efc6414a |
|
MD5 | 7db9cb9bc0e4d6913697adcb2b5625d8 |
|
BLAKE2b-256 | 64d739c2fd249658171bff27788f811077745ca7e9369df76b62186a544b1e41 |