feat: Session token short lived web admin (M2-11000) - #2102
Open
sricharan-varanasi wants to merge 6 commits into
Open
feat: Session token short lived web admin (M2-11000)#2102sricharan-varanasi wants to merge 6 commits into
sricharan-varanasi wants to merge 6 commits into
Conversation
adeiji
approved these changes
Jul 24, 2026
adeiji
left a comment
Contributor
There was a problem hiding this comment.
This looks good @sricharan-varanasi !
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.
Curious open source credit page
📝 Description
🔗 Jira Ticket M2-11000
Stacked on #2097 (BE-1, client identification). Base branch is
session-token-client-type;Gives web and admin clients shorter session-token lifetimes, while mobile keep today's lifetimes unchanged. Reuses the
clientJWT claim added in #2097 to decide which lifetime applies.Changes include:
web_admin_expirationsetting on bothAccessTokenSettingsandRefreshTokenSettings, plus atoken_expiration_minutesresolver that routes web/admin to the short value and everyone else to the existing value._get_refresh_token_by_access) to use the per-client lifetime, so a revoked short-lived token cannot be un-revoked early by blacklist cleanup.🪤 Peer Testing
Run locally with
AUTHENTICATION__ACCESS_TOKEN__WEB_ADMIN_EXPIRATION=1andAUTHENTICATION__REFRESH_TOKEN__WEB_ADMIN_EXPIRATION=3(minutes) to make the windows easy to observe.POST /auth/loginwith headerMindlogger-Content-Source: admin(orweb); decode both returned tokens.Expected outcome: access
exp≈ now + 1 min, refreshexp≈ now + 3 min.POST /auth/loginwithMindlogger-Content-Source: mobile, or with no header.Expected outcome: access ≈ now + 30 min, refresh ≈ now + 540 min (unchanged).
POST /auth/token/refreshwith the admin refresh token.Expected outcome: a new short-lived access token; once the refresh window elapses, refresh returns 400 (expired) and the user must log in again.
POST /auth/login(admin) →POST /auth/logout→POST /auth/token/refreshwith that refresh token.Expected outcome: 401 - logout revoked the paired refresh token.
✏️ Notes
config/authentication.py, so this takes effect in every environment on deploy. They can be overridden per environment via theAUTHENTICATION__*_TOKEN__WEB_ADMIN_EXPIRATIONenv vars.