Skip to content

Conversation

@ikovic
Copy link
Collaborator

@ikovic ikovic commented Apr 23, 2025

Description

When the org switching flow involves a redirect (in case of SSO via OIDC/SAML), the SDK would not finish the flow properly as after loading the page again it loses any in-memory context.

Specifically, we observed this sequence of events in the SlashID Console:

  • a user logs in to the root dashboard org (local storage has the token stored under root oid)
  • then they switch to the target org
  • assuming SAML is configured properly, they get redirected to the IdPs login page
  • after successful auth they are redirected back to the Console

Then the SDK does the following:

  • there are challenges in the URL so it resolves them, obtaining a new token for the target org
  • since the OID hasn't changed, the new token is stored under the initial OID, which is the root org ID
  • then the Console initiates the org switch, but the SDK cannot find the token for the target org as it was stored under the root org ID

To fix this, this PR adds a flag that uses sessionStorage to survive the redirect and tell the SDK to store the new token under the target org namespace.

Checklist

  • I have added tests that prove my fix is effective or that my feature works
  • I have generated the new version of the docs website and smoke tested it
  • I have checked that my changes haven't caused semantic errors in the existing docs
  • I have generated a changeset if my change affects the published packages

@ikovic ikovic self-assigned this Apr 23, 2025
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Apr 23, 2025

Deploying website-react-storybook with  Cloudflare Pages  Cloudflare Pages

Latest commit: 95e7418
Status: ✅  Deploy successful!
Preview URL: https://1b774df8.website-react-storybook.pages.dev
Branch Preview URL: https://sid-fix-org-switching-with-r.website-react-storybook.pages.dev

View logs

@ikovic ikovic merged commit 7c5b9c5 into main Apr 23, 2025
3 of 4 checks passed
@ikovic ikovic deleted the sid-fix-org-switching-with-redirect branch April 23, 2025 14:05
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.

4 participants