{"repo":"OSSMafia/fastapi-clerk-middleware","free":true,"listed":false,"github":"https://github.com/OSSMafia/fastapi-clerk-middleware","clone":"git clone https://github.com/OSSMafia/fastapi-clerk-middleware.git","description":"FastAPI Auth Middleware for Clerk (https://clerk.com)","language":"Python","stars":42,"topics":["clerk","clerk-auth","clerk-authentication","clerkauth","fastapi","authentication","jwks","python"],"license":"MIT","category":"auth-billing-email","readme_excerpt":"FastAPI Clerk Auth Middleware A lightweight, easy-to-use authentication middleware for FastAPI that integrates with Clerk authentication services. This middleware allows you to secure your FastAPI routes by validating JWT tokens against your Clerk JWKS endpoint, making it simple to implement authentication in your API. Features - 🔒 Secure API routes with Clerk JWT validation - 🚀 Simple integration with FastAPI's dependency injection system - ⚙️ Flexible configuration options (auto error responses, request state access) - 📝 Decoded token payload accessible in your route handlers Installation Basic Usage The returned credentials model will be an HTTPAuthorizationCredentials object with these properties: - scheme : Indicates the scheme of the Authorization header (Bearer) - credentials : Raw token received from the Authorization header - decoded : The payload of the decoded token Configuration Options Debug Mode By default, the middleware suppresses exceptions in order to prevent logging sensitive information. You can change this behavior in the ClerkHTTPBearer : Fixing Issued At Time (IAT) Errors In some instances the system clock of an API may be slightly out-of-sync which can cause issues with verifying the iat claim. This can be solved one of two ways: 1: Disable verifying the iat claim, there could be security implications by disabling so make sure it is secure for your use case. 2: Adding leeway which is a number of seconds to allow tolerance for drift, it can compensat","default_branch":null,"files":null,"tree":[],"storefront":"/r/OSSMafia","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/OSSMafia/fastapi-clerk-middleware/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}