Skip to content

SDKs: sign-out revokes DPoP-bound refresh tokens so the Keycloak session ends - #45

Open
pnzrr wants to merge 1 commit into
mainfrom
jp/dpop-logout
Open

pnzrr wants to merge 1 commit into
mainfrom
jp/dpop-logout

Conversation

@pnzrr

@pnzrr pnzrr commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Found while building the web SDK (#44, spec/22 §5).

Bug. With DPoP on (the default), CredentialsManager.logout() on iOS and Android cleared local state but left the Keycloak session alive. Keycloak 26.4–26.8 refuses a DPoP-bound refresh token on /protocol/openid-connect/logout with invalid_grant: DPoP proof is missing, even when a proof is sent: TokenManager.verifyRefreshToken reads a session attribute that only the token endpoint sets. The SDKs sent no proof and logged the failure as a warning. React Native and Flutter inherit the native behavior.

Fix. Sign-out revokes a DPoP-bound refresh token (with a proof); revocation ends the session. Bearer sessions keep using the logout endpoint. Tokens.revoke and Tokens.logout now send a proof whenever the SDK has a key.

Tests.

  • DPoPLogoutIT (Keycloak 26.8.1): logout with a proof is refused and the session survives; revoke with a proof ends it. It will fail once Keycloak fixes /logout, telling us we can go back to it.
  • Kotlin CredentialsAndTokensTest.logoutRevokesADPoPBoundRefreshToken; existing replay tests pass. Swift core builds.

…ssion ends

Keycloak 26.4-26.8 refuses a DPoP-bound refresh token on /protocol/openid-connect/logout
("DPoP proof is missing", even with a proof: TokenManager.verifyRefreshToken reads a proof only
the token endpoint parses). CredentialsManager.logout() logged that and cleared local state, so
the server session lived on. It now revokes DPoP-bound refresh tokens (with a proof), which ends
the session; Bearer sessions keep using the logout endpoint. revoke and logout send a proof when
the SDK has a key. DPoPLogoutIT records the server behavior; it fails once Keycloak fixes /logout.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant