Skip to content

feat: The OIDC logout flow is supported#205

Draft
mrudatsprint wants to merge 8 commits into
miker/eng-4800/code-grant-finishfrom
miker/eng-4802/start-logout
Draft

feat: The OIDC logout flow is supported#205
mrudatsprint wants to merge 8 commits into
miker/eng-4800/code-grant-finishfrom
miker/eng-4802/start-logout

Conversation

@mrudatsprint

@mrudatsprint mrudatsprint commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

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.

… 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.
@mrudatsprint
mrudatsprint changed the base branch from main to miker/eng-4800/code-grant-finish July 23, 2026 19:54
@mrudatsprint mrudatsprint changed the title feat: SDKCore: implement startLogout() and getAccessToken() (ENG-4802) feat: The OIDC logout flow is supported Jul 24, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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() to SDKCore and DPoPManager, 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 a finally) 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.

Comment thread packages/core/src/SDKCore/SDKCore.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
   *

Comment thread packages/core/src/SDKCore/SDKCore.ts

@mrudatsprint mrudatsprint left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self-review

/**
* Returns the stored access token string, or `null` if none is stored.
*/
getAccessToken(): string | null {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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.

2 participants