@passkeyme/react-auth 2.2.3 → 2.2.4
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.esm.js +11 -11
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +11 -11
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -6473,7 +6473,8 @@ const PasskeymeCallbackHandler = ({ loadingComponent: LoadingComponent, errorCom
|
|
|
6473
6473
|
authenticatedUser: null,
|
|
6474
6474
|
});
|
|
6475
6475
|
// Track if we've already processed the callback to prevent loops
|
|
6476
|
-
|
|
6476
|
+
// Using useRef instead of useState to avoid triggering re-renders when marked as processed
|
|
6477
|
+
const callbackProcessedRef = useRef(false);
|
|
6477
6478
|
// Get effective passkey configuration (merge config with props)
|
|
6478
6479
|
const effectivePasskeyConfig = {
|
|
6479
6480
|
promptRegistration: (_d = (_b = (_a = passkey === null || passkey === void 0 ? void 0 : passkey.promptRegistration) !== null && _a !== void 0 ? _a : config.autoPromptPasskeyRegistration) !== null && _b !== void 0 ? _b : (_c = config.passkey) === null || _c === void 0 ? void 0 : _c.autoPromptRegistration) !== null && _d !== void 0 ? _d : true, // Default to true
|
|
@@ -6707,7 +6708,7 @@ const PasskeymeCallbackHandler = ({ loadingComponent: LoadingComponent, errorCom
|
|
|
6707
6708
|
};
|
|
6708
6709
|
useEffect(() => {
|
|
6709
6710
|
// Don't process callback again if we've already done it
|
|
6710
|
-
if (
|
|
6711
|
+
if (callbackProcessedRef.current)
|
|
6711
6712
|
return;
|
|
6712
6713
|
const processCallback = async () => {
|
|
6713
6714
|
try {
|
|
@@ -6727,7 +6728,7 @@ const PasskeymeCallbackHandler = ({ loadingComponent: LoadingComponent, errorCom
|
|
|
6727
6728
|
if (error) {
|
|
6728
6729
|
const errorMessage = errorDescription || error || "Authentication failed";
|
|
6729
6730
|
updateState({ loading: false, error: errorMessage, success: false });
|
|
6730
|
-
|
|
6731
|
+
callbackProcessedRef.current = true;
|
|
6731
6732
|
if (onError) {
|
|
6732
6733
|
onError(errorMessage);
|
|
6733
6734
|
}
|
|
@@ -6766,7 +6767,7 @@ const PasskeymeCallbackHandler = ({ loadingComponent: LoadingComponent, errorCom
|
|
|
6766
6767
|
});
|
|
6767
6768
|
debugLog(config, "CallbackHandler", "Token flow - updated state, showPasskeyPrompt:", shouldPrompt);
|
|
6768
6769
|
// Mark callback as processed to prevent re-execution
|
|
6769
|
-
|
|
6770
|
+
callbackProcessedRef.current = true;
|
|
6770
6771
|
if (!shouldPrompt) {
|
|
6771
6772
|
// Proceed with normal redirect
|
|
6772
6773
|
proceedWithRedirect();
|
|
@@ -6779,7 +6780,7 @@ const PasskeymeCallbackHandler = ({ loadingComponent: LoadingComponent, errorCom
|
|
|
6779
6780
|
error: errorMessage,
|
|
6780
6781
|
success: false,
|
|
6781
6782
|
});
|
|
6782
|
-
|
|
6783
|
+
callbackProcessedRef.current = true;
|
|
6783
6784
|
if (onError) {
|
|
6784
6785
|
onError(errorMessage);
|
|
6785
6786
|
}
|
|
@@ -6817,7 +6818,7 @@ const PasskeymeCallbackHandler = ({ loadingComponent: LoadingComponent, errorCom
|
|
|
6817
6818
|
});
|
|
6818
6819
|
debugLog(config, "CallbackHandler", "OAuth code flow - updated state, showPasskeyPrompt:", shouldPrompt);
|
|
6819
6820
|
// Mark callback as processed to prevent re-execution
|
|
6820
|
-
|
|
6821
|
+
callbackProcessedRef.current = true;
|
|
6821
6822
|
if (!shouldPrompt) {
|
|
6822
6823
|
// Proceed with normal redirect
|
|
6823
6824
|
proceedWithRedirect();
|
|
@@ -6830,7 +6831,7 @@ const PasskeymeCallbackHandler = ({ loadingComponent: LoadingComponent, errorCom
|
|
|
6830
6831
|
error: errorMessage,
|
|
6831
6832
|
success: false,
|
|
6832
6833
|
});
|
|
6833
|
-
|
|
6834
|
+
callbackProcessedRef.current = true;
|
|
6834
6835
|
if (onError) {
|
|
6835
6836
|
onError(errorMessage);
|
|
6836
6837
|
}
|
|
@@ -6848,7 +6849,7 @@ const PasskeymeCallbackHandler = ({ loadingComponent: LoadingComponent, errorCom
|
|
|
6848
6849
|
if (!token && !code) {
|
|
6849
6850
|
const errorMessage = "No authentication token or code received";
|
|
6850
6851
|
updateState({ loading: false, error: errorMessage, success: false });
|
|
6851
|
-
|
|
6852
|
+
callbackProcessedRef.current = true;
|
|
6852
6853
|
if (onError) {
|
|
6853
6854
|
onError(errorMessage);
|
|
6854
6855
|
}
|
|
@@ -6861,12 +6862,12 @@ const PasskeymeCallbackHandler = ({ loadingComponent: LoadingComponent, errorCom
|
|
|
6861
6862
|
}
|
|
6862
6863
|
}
|
|
6863
6864
|
// Mark as processed if we got here
|
|
6864
|
-
|
|
6865
|
+
callbackProcessedRef.current = true;
|
|
6865
6866
|
}
|
|
6866
6867
|
catch (err) {
|
|
6867
6868
|
const errorMessage = err instanceof Error ? err.message : "Authentication failed";
|
|
6868
6869
|
updateState({ loading: false, error: errorMessage, success: false });
|
|
6869
|
-
|
|
6870
|
+
callbackProcessedRef.current = true;
|
|
6870
6871
|
if (onError) {
|
|
6871
6872
|
onError(errorMessage);
|
|
6872
6873
|
}
|
|
@@ -6881,7 +6882,6 @@ const PasskeymeCallbackHandler = ({ loadingComponent: LoadingComponent, errorCom
|
|
|
6881
6882
|
};
|
|
6882
6883
|
processCallback();
|
|
6883
6884
|
}, [
|
|
6884
|
-
callbackProcessed,
|
|
6885
6885
|
handleCallback,
|
|
6886
6886
|
handleTokenCallback,
|
|
6887
6887
|
onError,
|