Skip to content

Commit

Permalink
Fix fastapi-users#253 and fastapi-users#258: improve documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
frankie567 committed Jul 20, 2020
1 parent 7630b20 commit 13ff31e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions docs/configuration/authentication/jwt.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,19 @@ This method expects that you provide a `Bearer` authentication with a valid JWT.
curl http://localhost:9000/protected-route -H'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiOTIyMWZmYzktNjQwZi00MzcyLTg2ZDMtY2U2NDJjYmE1NjAzIiwiYXVkIjoiZmFzdGFwaS11c2VyczphdXRoIiwiZXhwIjoxNTcxNTA0MTkzfQ.M10bjOe45I5Ncu_uXvOmVV8QxnL-nZfcH96U90JaocI'
```

## Tip: Refresh

The default implementation **does not** provide a mechanism to refresh the JWT. However, you can implement it quite easily like this:

```py
from fastapi import Depends, Response


@router.post("/auth/jwt/refresh")
async def refresh_jwt(response: Response, user=Depends(fastapi_users.get_current_active_user)):
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).
2 changes: 1 addition & 1 deletion docs/usage/routes.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ Each OAuth router you define will expose the two following routes.
Return the authorization URL for the OAuth service where you should redirect your user.

!!! abstract "Query parameters"
* `authentication_backend`: Name of a defined [authentication method](../configuration/authentication/index.md) to use to authenticate the user on successful callback.
* `authentication_backend`: `name` property of a defined [authentication method](../configuration/authentication/index.md) to use to authenticate the user on successful callback. Usually `jwt` or `cookie`.
* `scopes`: Optional list of scopes to ask for. Expected format: `scopes=a&scopes=b`.

!!! success "`200 OK`"
Expand Down

0 comments on commit 13ff31e

Please sign in to comment.