@passkeyme/react-auth 2.2.1 → 2.2.3

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
@@ -6718,6 +6718,12 @@ const PasskeymeCallbackHandler = ({ loadingComponent: LoadingComponent, errorCom
6718
6718
  const code = urlParams.get("code");
6719
6719
  const error = urlParams.get("error");
6720
6720
  const errorDescription = urlParams.get("error_description");
6721
+ debugLog(config, "CallbackHandler", "Extracted from URL:", {
6722
+ token: !!token,
6723
+ code: !!code,
6724
+ error,
6725
+ errorDescription,
6726
+ });
6721
6727
  // Handle OAuth errors from the provider
6722
6728
  if (error) {
6723
6729
  const errorMessage = errorDescription || error || "Authentication failed";
@@ -6760,6 +6766,8 @@ const PasskeymeCallbackHandler = ({ loadingComponent: LoadingComponent, errorCom
6760
6766
  showPasskeyPrompt: shouldPrompt,
6761
6767
  });
6762
6768
  debugLog(config, "CallbackHandler", "Token flow - updated state, showPasskeyPrompt:", shouldPrompt);
6769
+ // Mark callback as processed to prevent re-execution
6770
+ setCallbackProcessed(true);
6763
6771
  if (!shouldPrompt) {
6764
6772
  // Proceed with normal redirect
6765
6773
  proceedWithRedirect();
@@ -6809,6 +6817,8 @@ const PasskeymeCallbackHandler = ({ loadingComponent: LoadingComponent, errorCom
6809
6817
  showPasskeyPrompt: shouldPrompt,
6810
6818
  });
6811
6819
  debugLog(config, "CallbackHandler", "OAuth code flow - updated state, showPasskeyPrompt:", shouldPrompt);
6820
+ // Mark callback as processed to prevent re-execution
6821
+ setCallbackProcessed(true);
6812
6822
  if (!shouldPrompt) {
6813
6823
  // Proceed with normal redirect
6814
6824
  proceedWithRedirect();
@@ -6871,7 +6881,16 @@ const PasskeymeCallbackHandler = ({ loadingComponent: LoadingComponent, errorCom
6871
6881
  }
6872
6882
  };
6873
6883
  processCallback();
6874
- }, [callbackProcessed]); // Only depend on callbackProcessed to prevent loops
6884
+ }, [
6885
+ callbackProcessed,
6886
+ handleCallback,
6887
+ handleTokenCallback,
6888
+ onError,
6889
+ onSuccess,
6890
+ errorRedirect,
6891
+ successRedirect,
6892
+ config.debug,
6893
+ ]);
6875
6894
  // Handle auth errors from the SDK
6876
6895
  React.useEffect(() => {
6877
6896
  if (authError) {