Sign out should also end the Authentik SSO session (RP-Initiated Logout) #19
Reference in New Issue
Block a user
Delete Branch "%!s()"
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?
Today, POST /api/auth/logout only destroys this app's own session -- it never touches Authentik's session on auth.jerodrigged.com. Someone who signed in via "Sign in with Authentik", then signs out of the dashboard, is still logged into Authentik itself; clicking the button again silently re-authenticates with no prompt.
Fix is OIDC RP-Initiated Logout: redirect through Authentik's end_session_endpoint (https://auth.jerodrigged.com/application/o/homelab-monitor/end-session/) with id_token_hint + post_logout_redirect_uri, rather than just clearing our local session.
Needs:
Starting this one.
Follow-up after the initial fix: found and fixed two related bugs during verification.
First RP-Initiated Logout attempt was app-scoped only -- Authentik's
default-provider-invalidation-flowends only this app's session, leaving Authentik's own browser cookie valid, so "Sign in with Authentik" would silently re-authenticate with no prompt. Switched the provider'sinvalidation_flowtodefault-invalidation-flow(full logout). Verified via Playwright click-through both ways.Username field showed a raw session-token-looking hash next to the sign-out button (user-reported). Root cause: the OAuth2Provider had no
property_mappings, so the ID token never carriedpreferred_username/email-- the app's fallback landed on the rawsubhash. Fixed by attaching Authentik's default openid/profile/email scope mappings. No app code change needed.Also version-controlled the Authentik blueprint at
deploy/authentik/homelab-monitor-oidc.yaml(previously only lived on CT121 via ad-hoc scp), and added Playwright regression coverage for both bugs ine2e/tests/oidc-login.spec.ts. Full suite green (16 passed, 1 cleanly skipped -- unrelated device-labeling drift indeep-check.spec.ts). Details indocs/oidc-setup.md.