feat: PATCH /users/<id>/reset-auth-token — rotate API token without invalidating sessions#2214
Draft
Copilot wants to merge 4 commits into
Draft
feat: PATCH /users/<id>/reset-auth-token — rotate API token without invalidating sessions#2214Copilot wants to merge 4 commits into
Copilot wants to merge 4 commits into
Conversation
Agent-Logs-Url: https://github.com/FlexMeasures/flexmeasures/sessions/fe1f22ac-0352-484a-96f4-2f4057311057 Co-authored-by: Flix6x <30658763+Flix6x@users.noreply.github.com>
Co-authored-by: Flix6x <30658763+Flix6x@users.noreply.github.com>
Co-authored-by: Flix6x <30658763+Flix6x@users.noreply.github.com>
Copilot
AI
changed the title
Phase 1: Auth token reset endpoint + UI (Issue #1800)
feat: PATCH /users/<id>/reset-auth-token — rotate API token without invalidating sessions
Jun 1, 2026
Copilot created this pull request from a session on behalf of
Flix6x
June 1, 2026 09:20
View session
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Member
|
Are you aware of pallets-eco/flask-security#1206 ? |
Member
Oh wait, this is about resetting tokens. The refresh token thing might be a different spike. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
From issue #1800's tech spike (Option A): add a dedicated endpoint to rotate a user's API auth token (
fs_token_uniquifier) independently of their browser session (fs_uniquifier).Backend
reset_token_access(user)indata/services/users.py— callsuser_datastore.set_token_uniquifier(user), leavingfs_uniquifier(and thus cookies/sessions) intactPATCH /api/v3_0/users/<id>/reset-auth-token— requiresupdatepermission, writes an audit log entry; mirrors existingPATCH /<id>/password-resetpatternUI
/logged-in-user(self-service) and/users/<id>(shown to users withupdatepermission)fetch PATCH+ toast; self-service page reloads to surface the newly-issued tokenConfig
SECURITY_TOKEN_MAX_AGE = None(no expiry) was already set — no change neededTests
test_user_reset_auth_token(6 parametrized cases): verifies 401/403/200 auth rules, assertsfs_uniquifieris unchanged after the call,fs_token_uniquifieris rotated, and the audit log record is created.