Skip to content

fix(oidc): preserve OIDC session params across mid-flow page refreshes - #1470

Draft
ruvenzx wants to merge 2 commits into
mainfrom
feat/add-oidc-redirect-state-management
Draft

fix(oidc): preserve OIDC session params across mid-flow page refreshes#1470
ruvenzx wants to merge 2 commits into
mainfrom
feat/add-oidc-redirect-state-management

Conversation

@ruvenzx

@ruvenzx ruvenzx commented May 18, 2026

Copy link
Copy Markdown
Contributor

When a user refreshes the page mid-flow, all URL params (including state_id, sso_app_id, oidc_error_redirect_uri, etc.) are lost, causing the Descope SDK to start a new OIDC session with no redirect context. Without state_id in particular, the SDK cannot look up the original authorization request and onSuccessRedirectUrl is never produced.

Adds initOidcSession() called synchronously in index.tsx before React renders: saves all non-transient URL params to sessionStorage when sso_app_id is present, and restores them into the URL via replaceState on refresh so the SDK reconnects to the existing OIDC session. Calls clearOidcSession() in onSuccess to prevent stale params from leaking into unrelated visits within the same tab.

Related Issues

related to https://github.com/descope/etc/issues/15556

Description

💬 A few sentences describing the overall goals of the pull request's commits.

Screenshots

📺🔫 All of the UI influenced by this PR

Must

  • 📱 Responsiveness (mobile/XL resolutions)
  • 🧪 Tests
  • 📃 Documentation (if applicable)

When a user refreshes the page mid-flow, all URL params (including
state_id, sso_app_id, oidc_error_redirect_uri, etc.) are lost, causing
the Descope SDK to start a new OIDC session with no redirect context.
Without state_id in particular, the SDK cannot look up the original
authorization request and onSuccessRedirectUrl is never produced.

Adds initOidcSession() called synchronously in index.tsx before React
renders: saves all non-transient URL params to sessionStorage when
sso_app_id is present, and restores them into the URL via replaceState
on refresh so the SDK reconnects to the existing OIDC session.
Calls clearOidcSession() in onSuccess to prevent stale params from
leaking into unrelated visits within the same tab.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ruvenzx ruvenzx self-assigned this May 18, 2026
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