Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Upload Python Package
name: Publish

on:
release:
Expand All @@ -18,7 +15,7 @@ jobs:

- uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: "3.13"
cache: "poetry"

- name: Setup poetry
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python package
name: Build

on:
push:
Expand Down Expand Up @@ -41,3 +38,4 @@ jobs:
- name: Test pydantic v1 compatibility
working-directory: ./tests
run: poetry run pip install 'pydantic<2' && poetry run pytest
- run: poetry build
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.10.3

- Bump dependencies

## 1.10.2

- Bump dependencies
Expand Down
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pip install fastapi-login

## Usage

To begin we have to setup our FastAPI app:
To begin we have to set up our FastAPI app:

```python
from fastapi import FastAPI
Expand All @@ -31,10 +31,9 @@ SECRET = 'your-secret-key'
app = FastAPI()
```

To obtain a suitable secret key you can run ``import os; print(os.urandom(24).hex())``.
To obtain a suitable secret key you can run `import secrets; secrets.token_hex(24)`.

Now we can import and setup the LoginManager, which will handle the process of
encoding and decoding our Json Web Tokens.
Now we can import and setup the `LoginManager`, which will handle the process of encoding and decoding our Json Web Tokens.

```python
from fastapi_login import LoginManager
Expand Down Expand Up @@ -114,7 +113,7 @@ app.add_exception_handler(NotAuthenticatedException, exc_handler)
```

To change the expiration date of the token use the ``expires_delta`` argument of the `create_access_token` method
with a timedelta. The default is set 15 min. Please be aware that setting a long expiry date is not considered a good practice
with `timedelta`. The default is set 15 min. Please be aware that setting a long expiry date is not considered a good practice
as it would allow an attacker with the token to use your application as long as he wants.

```python
Expand Down Expand Up @@ -161,5 +160,4 @@ def auth(response: Response, user=Depends(manager)):
)
manager.set_cookie(response, token)
return response

```
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ ruff = "^0.8.2"

[tool.poetry.group.test.dependencies]
async-asgi-testclient = "*"
pytest = ">=7"
pytest = ">=8"
pytest-asyncio = "*"
pytest-lazy-fixtures = "^1.1.1"

Expand Down
Loading