diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 3b4a70be33ebf01ed8c37cdff7e93ceb0471aef2..34feb6f21fab7c335c0abe4ebab95ee94e095624 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -9,6 +9,11 @@ and this project adheres to `Semantic Versioning`_. Unreleased ---------- +Added +~~~~~ + +* [OAuth] Expired tokens are now cleared in a periodic task + Fixed ~~~~~ diff --git a/aleksis/core/tasks.py b/aleksis/core/tasks.py index 13eb76444b77e84ca7509958f02517c98b678296..97ccfa2270b9d87ab8698414ce87c53f06446d22 100644 --- a/aleksis/core/tasks.py +++ b/aleksis/core/tasks.py @@ -40,3 +40,11 @@ def backup_data() -> None: # Hand off to dbbackup's management commands management.call_command("dbbackup", *db_options) management.call_command("mediabackup", *media_options) + + +@app.task(run_every=timedelta(days=1)) +def clear_oauth_tokens(): + """Clear expired OAuth2 tokens.""" + from oauth2_provider.models import clear_tokens # noqa + + return clear_tokens()