@passkeyme/react-auth 2.2.5 → 2.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -6687,12 +6687,11 @@ const PasskeymeCallbackHandler = ({ loadingComponent: LoadingComponent, errorCom
6687
6687
  };
6688
6688
  // Proceed with redirect after auth completion
6689
6689
  const proceedWithRedirect = async () => {
6690
- // Clean URL immediately to prevent effect re-run with stale URL params
6691
- window.history.replaceState({}, document.title, window.location.pathname);
6692
6690
  setTimeout(async () => {
6693
6691
  const currentUser = state.authenticatedUser || user;
6694
6692
  if (onSuccess && currentUser) {
6695
- // Use auth's getAccessToken method instead of direct localStorage access
6693
+ // For custom callbacks, execute immediately without URL cleanup
6694
+ // The parent component should handle navigation after the callback
6696
6695
  try {
6697
6696
  const token = await auth.getAccessToken();
6698
6697
  onSuccess(currentUser, token || "");
@@ -6703,7 +6702,8 @@ const PasskeymeCallbackHandler = ({ loadingComponent: LoadingComponent, errorCom
6703
6702
  }
6704
6703
  }
6705
6704
  else {
6706
- // Redirect to success page
6705
+ // For redirects, clean URL before navigating away
6706
+ window.history.replaceState({}, document.title, window.location.pathname);
6707
6707
  window.location.href = successRedirect;
6708
6708
  }
6709
6709
  }, 100);