mirror of
https://github.com/fastapi-users/fastapi-users.git
synced 2026-03-13 07:49:55 +08:00
Rework the documentation
This commit is contained in:
@@ -9,11 +9,7 @@ from fastapi_users.authentication import CookieAuthentication
|
||||
|
||||
SECRET = "SECRET"
|
||||
|
||||
auth_backends = []
|
||||
|
||||
cookie_authentication = CookieAuthentication(secret=SECRET, lifetime_seconds=3600)
|
||||
|
||||
auth_backends.append(cookie_authentication)
|
||||
```
|
||||
|
||||
As you can see, instantiation is quite simple. It accepts the following arguments:
|
||||
@@ -58,7 +54,3 @@ This method will remove the authentication cookie:
|
||||
## Authentication
|
||||
|
||||
This method expects that you provide a valid cookie in the headers.
|
||||
|
||||
## Next steps
|
||||
|
||||
We will now configure the main **FastAPI Users** object that will expose the [routers](../routers/index.md).
|
||||
|
||||
@@ -9,11 +9,7 @@ from fastapi_users.authentication import JWTAuthentication
|
||||
|
||||
SECRET = "SECRET"
|
||||
|
||||
auth_backends = []
|
||||
|
||||
jwt_authentication = JWTAuthentication(secret=SECRET, lifetime_seconds=3600, tokenUrl="auth/jwt/login")
|
||||
|
||||
auth_backends.append(jwt_authentication)
|
||||
```
|
||||
|
||||
As you can see, instantiation is quite simple. It accepts the following arguments:
|
||||
@@ -69,7 +65,3 @@ from fastapi import Depends, Response
|
||||
async def refresh_jwt(response: Response, user=Depends(fastapi_users.current_user(active=True))):
|
||||
return await jwt_authentication.get_login_response(user, response)
|
||||
```
|
||||
|
||||
## Next steps
|
||||
|
||||
We will now configure the main **FastAPI Users** object that will expose the [routers](../routers/index.md).
|
||||
|
||||
Reference in New Issue
Block a user