fix(account): refresh the session groups from keycloak on the account page #361

Sammanfogat
supernaut sammanfogade 1 incheckning från fix/refresh-groups-after-payment in i main 2026-10-11 16:48:08 +00:00
Ägare

Refs bitborg/bitborg-payment#131

The session cookie keeps the groups from the sign-in ID token. After a payment, billing moves the user from tier_trial to tier_pro in Keycloak. The account page kept showing the trial plan until the user signed out and in again. Seen on staging on 2026-10-11.

The account page now reads the user's groups with the portal's Keycloak admin client, by the session sub. When they differ from the session, the page re-signs the session cookie before the panel island renders. The same refresh covers downgrades, such as a trial ending or a cancelled plan.

  • One admin GET /users/{id}/groups per account page view. No other page calls Keycloak.
  • A failed lookup or save keeps the current session. The page never fails because of it.
  • Groups come from Keycloak only, never from the request.
  • The refresh runs in the page, not the island: only the page response can set the cookie the island reads.
  • When the groups change, the session lifetime restarts at 8 hours, as the Renovate toggle already does.
  • Version 1.34.8.

Tests: unit tests for getUserGroups and refreshGroups, written failing first. pnpm test, check, lint, build, e2e pass. The account page itself needs a real sign-in, so staging is the end-to-end proof.

Refs bitborg/bitborg-payment#131 The session cookie keeps the groups from the sign-in ID token. After a payment, billing moves the user from `tier_trial` to `tier_pro` in Keycloak. The account page kept showing the trial plan until the user signed out and in again. Seen on staging on 2026-10-11. The account page now reads the user's groups with the portal's Keycloak admin client, by the session `sub`. When they differ from the session, the page re-signs the session cookie before the panel island renders. The same refresh covers downgrades, such as a trial ending or a cancelled plan. - One admin `GET /users/{id}/groups` per account page view. No other page calls Keycloak. - A failed lookup or save keeps the current session. The page never fails because of it. - Groups come from Keycloak only, never from the request. - The refresh runs in the page, not the island: only the page response can set the cookie the island reads. - When the groups change, the session lifetime restarts at 8 hours, as the Renovate toggle already does. - Version 1.34.8. Tests: unit tests for `getUserGroups` and `refreshGroups`, written failing first. `pnpm test`, `check`, `lint`, `build`, e2e pass. The account page itself needs a real sign-in, so staging is the end-to-end proof.
supernaut lade till 1 incheckning 2026-10-11 16:45:47 +00:00
fix(account): refresh the session groups from keycloak on the account page
Alla kontroller lyckades
ci / ci (pull_request) Successful in 1m49s
c0d0b0de53
The session cookie keeps the groups from the sign-in ID token. After a
payment, billing moves the user from tier_trial to tier_pro, but the
account page kept showing the trial plan until the next sign-in.

The account page now reads the user's groups with the portal's Keycloak
admin client, by the session sub. When they differ, it re-signs the
session cookie before the panel island renders. A failed lookup keeps
the current session.
supernaut schemalade den här ändringsförfrågan för automatisk sammanfogning när alla kontroller lyckas 2026-10-11 16:46:33 +00:00
supernaut sammanfogade incheckning d675be0922 till main 2026-10-11 16:48:08 +00:00
supernaut tog bort grenen fix/refresh-groups-after-payment 2026-10-11 16:48:08 +00:00
Logga in för att delta i denna konversation.
Inga granskare
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Förfallodatumet är ogiltigt eller utanför gränserna. Använd formatet "åååå-mm-dd".

Inget förfallodatum satt.

Beroenden

Inga beroenden satta

Referens
bitborg/bitborg-web!361
Ingen beskrivning angiven.