feat: The OIDC logout flow is supported#205
Conversation
… mode (ENG-4802) - startLogout() in DPoP mode now awaits DPoPManager.clear() (key pair, tokens, nonces) before redirecting, mirroring startLogin()'s fire-and-forget async pattern. Cookie mode is unchanged. - New DPoPManager.getAccessToken() delegate (mirrors getRefreshToken()). - New public SDKCore.getAccessToken(): returns the stored DPoP access token, or throws in cookie mode. - Unit tests for both in SDKCore.test.ts and DPoPManager.test.ts. - e2e dpop-smoke.test.ts: new startLogout() smoke test reusing the logged-in SDKCore from the authorization code grant test.
There was a problem hiding this comment.
Pull request overview
This PR adds support for the OIDC logout flow in @fusionauth-sdk/core, ensuring DPoP-mode logout clears local DPoP state (key pair, tokens, nonces) before redirecting, and introduces an accessor for reading the DPoP-bound access token (with tests).
Changes:
- Implement DPoP-aware
startLogout()which clears DPoP state prior to redirecting to the logout URL. - Add
getAccessToken()toSDKCoreandDPoPManager, with corresponding unit tests. - Extend the DPoP e2e smoke suite to validate logout state clearing + redirect behavior.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Dependency lock updates related to the repo’s toolchain/dev dependencies. |
| packages/core/src/SDKCore/SDKCore.ts | Adds DPoP-aware logout flow and a getAccessToken() accessor on SDKCore. |
| packages/core/src/SDKCore/SDKCore.test.ts | Unit tests for SDKCore.getAccessToken() behavior in DPoP vs cookie mode. |
| packages/core/src/DPoP/DPoPManager.ts | Adds DPoPManager.getAccessToken() to expose the stored access token. |
| packages/core/src/DPoP/DPoPManager.test.ts | Unit tests for DPoPManager.getAccessToken() and post-clear behavior. |
| e2e/tests/dpop-smoke.test.ts | Adds an e2e test ensuring startLogout() clears DPoP state before redirect. |
Comments suppressed due to low confidence (1)
packages/core/src/SDKCore/SDKCore.ts:109
- In DPoP mode, if
DPoPManager.clear()rejects, the.catch(...)handler prevents the redirect from happening at all, leaving the app stuck in a partially-logged-out state. Consider making the redirect unconditional (e.g., in afinally) and treat clearing local state as best-effort.
startLogout(): void {
if (this.dpopManager) {
this.startDpopLogout().catch(error => {
console.error('FusionAuth SDK: startLogout failed', error);
});
return;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
packages/core/src/SDKCore/SDKCore.ts:101
- The JSDoc has a grammatical error: “starting an asynchronously flow” should be “starting an asynchronous flow” (or similar).
* In DPoP mode, this synchronously returns after starting an
* asynchronously flow.
*
mrudatsprint
left a comment
There was a problem hiding this comment.
self-review
| /** | ||
| * Returns the stored access token string, or `null` if none is stored. | ||
| */ | ||
| getAccessToken(): string | null { |
There was a problem hiding this comment.
This is exposed so the application can call a resource server and is not able to use fetch. In this case the application needs to call generateProof and would need the accessToken in order to add it to the Authorization: DPoP header.
Issue:
Description:
The OIDC logout flow will clear the key pair, stored tokens and in-memory nonces.
Note, added an accessor to return the access token.