You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FastAPI Auth Middleware for [Clerk](https://clerk.com)
7
+
A lightweight, easy-to-use authentication middleware for [FastAPI](https://fastapi.tiangolo.com/) that integrates with [Clerk](https://clerk.com) authentication services.
5
8
6
-
Easily setup authentication on your API routes using your Clerk JWKS endpoint.
9
+
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.
10
+
11
+
## Features
12
+
13
+
- 🔒 Secure API routes with Clerk JWT validation
14
+
- 🚀 Simple integration with FastAPI's dependency injection system
The returned `credentials` model will either be of type `None` or `HTTPAuthorizationCredentials`. If the model is populated it will have the following properties:
32
-
- scheme
33
-
- Indicates the scheme of the Authorization header (Bearer)
34
-
- credentials
35
-
- Raw token received from the Authorization header
36
-
- decoded
37
-
- The payload of the decoded token
44
+
The returned `credentials` model will be either `None` or an `HTTPAuthorizationCredentials` object with these properties:
45
+
46
+
-`scheme`: Indicates the scheme of the Authorization header (Bearer)
47
+
-`credentials`: Raw token received from the Authorization header
48
+
-`decoded`: The payload of the decoded token
49
+
50
+
## Configuration Options
51
+
52
+
### Disabling Auto Errors
53
+
54
+
By default, the middleware automatically returns 403 errors if the token is missing or invalid. You can disable this behavior:
38
55
39
-
## Auto Errors
40
-
By default the middleware automatically returns 403 errors if the token is missing or invalid. You can disable that behavior by setting the following:
0 commit comments