Skip to content

docs: fix onSessionTokenChange documentation in web-component and webjs#1359

Open
ruvenzx wants to merge 5 commits intomainfrom
docs/fix-on-session-token-change-readme
Open

docs: fix onSessionTokenChange documentation in web-component and webjs#1359
ruvenzx wants to merge 5 commits intomainfrom
docs/fix-on-session-token-change-readme

Conversation

@ruvenzx
Copy link
Copy Markdown
Contributor

@ruvenzx ruvenzx commented Mar 31, 2026

fixes https://github.com/descope/etc/issues/14854

Description

onSessionTokenChange silently does nothing when completes a flow — the two SDKs have separate HTTP client instances, so the hook is never called by the web component.
This PR documents the fix in both READMEs: use DescopeWc.sdkConfigOverrides to share your SDK's afterRequest hook chain with the web component before mounting it.

Must

  • [] Tests
  • Documentation (if applicable)

…-js-sdk READMEs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ruvenzx ruvenzx requested a review from dorsha March 31, 2026 09:27
@ruvenzx ruvenzx self-assigned this Mar 31, 2026
Copilot AI review requested due to automatic review settings March 31, 2026 09:27
@shuni-bot-dev
Copy link
Copy Markdown
Contributor

shuni-bot-dev bot commented Mar 31, 2026

🐕 Review complete — View session on Shuni Portal 🐾

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 31, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
access-key-management-widget Ready Ready Preview, Comment Mar 31, 2026 9:46am
audit-management-widget Ready Ready Preview, Comment Mar 31, 2026 9:46am
role-management-widget Ready Ready Preview, Comment Mar 31, 2026 9:46am
user-management-widget Canceled Canceled Mar 31, 2026 9:46am
user-profile-widget Ready Ready Preview, Comment Mar 31, 2026 9:46am

Request Review

@ruvenzx ruvenzx changed the title docs: fix onSessionTokenChange documentation in web-component and web… docs: fix onSessionTokenChange documentation in web-component and webjs Mar 31, 2026
@nx-cloud
Copy link
Copy Markdown

nx-cloud bot commented Mar 31, 2026

View your CI Pipeline Execution ↗ for commit a393310

Command Status Duration Result
nx affected --target test:e2e ✅ Succeeded 1s View ↗
nx affected --target test ✅ Succeeded 32s View ↗
nx affected --target lint --fix=true ✅ Succeeded 5s View ↗
nx affected --target build ✅ Succeeded 4s View ↗
nx affected --target licenseCheck ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2026-03-31 10:30:07 UTC

Copy link
Copy Markdown
Contributor

@shuni-bot-dev shuni-bot-dev bot left a comment

Choose a reason for hiding this comment

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

🐕 Shuni's Review

Documents the workaround for onSessionTokenChange not firing when <descope-wc> completes a flow, by sharing afterRequest hooks via DescopeWc.sdkConfigOverrides.

Sniffed out 1 issue:

  • 1 🟡 MEDIUM: missing comma creates a run-on sentence

Code examples are accurate — verified sdk.httpClient.hooks.afterRequest, DescopeWc.sdkConfigOverrides, and the hooks/addHooks chain all the way through. Good bones! Woof!

Co-authored-by: shuni-bot-dev[bot] <254528481+shuni-bot-dev[bot]@users.noreply.github.com>
Signed-off-by: Reuven Zabirov <123939006+ruvenzx@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates SDK documentation to clarify why onSessionTokenChange doesn’t fire when auth flows complete inside <descope-wc> and how to configure the web component to reuse the web-js-sdk afterRequest hook chain so the callback triggers.

Changes:

  • Added a note + dedicated section in @descope/web-js-sdk README explaining the required <descope-wc> setup.
  • Added a new section in @descope/web-component README showing how to pass afterRequest hooks from a createSdk instance via DescopeWc.sdkConfigOverrides.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
packages/sdks/web-js-sdk/README.md Documents the <descope-wc> integration requirement for onSessionTokenChange and provides a setup example.
packages/sdks/web-component/README.md Documents how to wire @descope/web-js-sdk hooks into <descope-wc> so session token notifications fire on the SDK instance.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

ruvenzx and others added 3 commits March 31, 2026 12:42
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Reuven Zabirov <123939006+ruvenzx@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Reuven Zabirov <123939006+ruvenzx@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Reuven Zabirov <123939006+ruvenzx@users.noreply.github.com>
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