Skip to content

Commit

Permalink
fix: oidc redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
francesconi committed Dec 7, 2023
1 parent 87f0f24 commit 71b0389
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions examples/react-spa/src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,14 @@ export const sdkError = (
const currentUrl = new URL(window.location.href)
const redirect = new URL(
responseData.redirect_browser_to,
// need to add the base url since the `redirect_browser_to` is a relative url with no hostname
window.location.origin,
)

// Path has changed
if (currentUrl.pathname !== redirect.pathname) {
if (
currentUrl.hostname === redirect.hostname &&
currentUrl.pathname !== redirect.pathname
) {
console.warn("sdkError 422: Update path")
// remove /ui prefix from the path in case it is present (not setup correctly inside the project config)
// since this is an SPA we don't need to redirect to the Account Experience.
Expand Down

0 comments on commit 71b0389

Please sign in to comment.