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