fix(web): rotate JWT after tier-grant so the launcher unlocks without log-out (BUNYIP-226) #255
No reviewers
Labels
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
psa-systems/bunyip!255
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/BUNYIP-226-rotate-jwt-after-tier-grant"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Reproduced on staging with yousif+6: signup -> onboarding -> verify-email -> /dashboard rendered Membership card as "Trial / 30 days" (fresh from /memberships/me) but the Applications grid rendered Mokosh "Locked / Not Available" until the user manually logged out and back in. Root cause: BUNYIP-221's maybe_grant_initial_tier flipped trial_ends_at on the DB row, but the user's existing session cookie carries a JWT minted at login, BEFORE the grant. The /applications endpoint reads has_member_access() off those stale claims (trial_ends_at = None) and locks the tile. authenticate()'s existing refresh-on-401 path doesn't fire because the JWT is still valid, just out of date on the membership claims.
Explicitly rotate the access token at the two web-side call sites that can trigger the BUNYIP-221 grant:
A refresh failure in either path is non-fatal: the underlying grant still landed in the DB, the user just keeps the stale JWT until something else triggers a refresh, which is no worse than the pre-BUNYIP-226 behavior.
#BUNYIP-226