@passkeyme/react-auth 2.2.8 → 2.2.10
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/components/PasskeymeCallbackHandler.d.ts.map +1 -1
- package/dist/index.esm.js +23 -14
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +23 -14
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PasskeymeCallbackHandler.d.ts","sourceRoot":"","sources":["../../src/components/PasskeymeCallbackHandler.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAuLzD,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,iBAAiB,EAAE,GAAG,GAAG,IAAI,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,eAAO,MAAM,wBAAwB,GAAI,sIAQtC,6BAA6B,
|
|
1
|
+
{"version":3,"file":"PasskeymeCallbackHandler.d.ts","sourceRoot":"","sources":["../../src/components/PasskeymeCallbackHandler.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAuLzD,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,iBAAiB,EAAE,GAAG,GAAG,IAAI,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,eAAO,MAAM,wBAAwB,GAAI,sIAQtC,6BAA6B,mDA44B/B,CAAC"}
|
package/dist/index.esm.js
CHANGED
|
@@ -6607,7 +6607,7 @@ const PasskeymeCallbackHandler = ({ loadingComponent: LoadingComponent, errorCom
|
|
|
6607
6607
|
showPasskeyPrompt: false,
|
|
6608
6608
|
});
|
|
6609
6609
|
handlePasskeyRegistrationComplete(true);
|
|
6610
|
-
proceedWithRedirect();
|
|
6610
|
+
proceedWithRedirect(currentUser);
|
|
6611
6611
|
}
|
|
6612
6612
|
catch (error) {
|
|
6613
6613
|
console.error("Passkey registration failed:", error);
|
|
@@ -6651,7 +6651,7 @@ const PasskeymeCallbackHandler = ({ loadingComponent: LoadingComponent, errorCom
|
|
|
6651
6651
|
}
|
|
6652
6652
|
// This is actually a "success" case - user has passkeys, just localStorage was out of sync
|
|
6653
6653
|
handlePasskeyRegistrationComplete(true, "Passkey already registered and ready to use.");
|
|
6654
|
-
proceedWithRedirect();
|
|
6654
|
+
proceedWithRedirect(currentUser);
|
|
6655
6655
|
return;
|
|
6656
6656
|
}
|
|
6657
6657
|
else if (msg.includes("user cancelled") ||
|
|
@@ -6671,7 +6671,7 @@ const PasskeymeCallbackHandler = ({ loadingComponent: LoadingComponent, errorCom
|
|
|
6671
6671
|
handlePasskeyRegistrationComplete(false, "Passkey registration failed. You can try again later.");
|
|
6672
6672
|
}
|
|
6673
6673
|
// Always proceed with redirect - don't block user flow
|
|
6674
|
-
proceedWithRedirect();
|
|
6674
|
+
proceedWithRedirect(currentUser);
|
|
6675
6675
|
}
|
|
6676
6676
|
};
|
|
6677
6677
|
// Handle skipping passkey registration
|
|
@@ -6682,18 +6682,23 @@ const PasskeymeCallbackHandler = ({ loadingComponent: LoadingComponent, errorCom
|
|
|
6682
6682
|
sessionStorage.setItem("passkey_declined", Date.now().toString());
|
|
6683
6683
|
updateState({ showPasskeyPrompt: false });
|
|
6684
6684
|
handlePasskeyRegistrationComplete(false, "User chose to skip passkey registration");
|
|
6685
|
-
proceedWithRedirect();
|
|
6685
|
+
proceedWithRedirect(state.authenticatedUser);
|
|
6686
6686
|
};
|
|
6687
6687
|
// Proceed with redirect after auth completion
|
|
6688
|
-
const proceedWithRedirect = async () => {
|
|
6688
|
+
const proceedWithRedirect = async (authenticatedUser) => {
|
|
6689
6689
|
// CRITICAL: Clean URL synchronously BEFORE any async operations
|
|
6690
6690
|
// This prevents Next.js App Router from remounting the component with stale URL params
|
|
6691
6691
|
// Must happen outside setTimeout to execute immediately
|
|
6692
6692
|
window.history.replaceState({}, document.title, window.location.pathname);
|
|
6693
6693
|
setTimeout(async () => {
|
|
6694
|
-
|
|
6695
|
-
|
|
6696
|
-
|
|
6694
|
+
// Use passed user or fall back to state/context user
|
|
6695
|
+
const currentUser = authenticatedUser || state.authenticatedUser || user;
|
|
6696
|
+
// If custom onSuccess callback provided, use it and let parent handle navigation
|
|
6697
|
+
if (onSuccess) {
|
|
6698
|
+
if (!currentUser) {
|
|
6699
|
+
debugLog(config, "CallbackHandler", "Warning: onSuccess provided but no currentUser available");
|
|
6700
|
+
return;
|
|
6701
|
+
}
|
|
6697
6702
|
try {
|
|
6698
6703
|
const token = await auth.getAccessToken();
|
|
6699
6704
|
onSuccess(currentUser, token || "");
|
|
@@ -6702,14 +6707,18 @@ const PasskeymeCallbackHandler = ({ loadingComponent: LoadingComponent, errorCom
|
|
|
6702
6707
|
debugLog(config, "CallbackHandler", "Error getting access token:", error);
|
|
6703
6708
|
onSuccess(currentUser, "");
|
|
6704
6709
|
}
|
|
6710
|
+
return; // Don't proceed with redirect - parent handles navigation
|
|
6705
6711
|
}
|
|
6706
|
-
|
|
6712
|
+
// No custom callback - use successRedirect for navigation
|
|
6713
|
+
if (successRedirect) {
|
|
6707
6714
|
console.log("[CallbackHandler] Redirecting to success URL:", {
|
|
6708
6715
|
successRedirect,
|
|
6709
6716
|
});
|
|
6710
|
-
// For redirects, navigate to success page
|
|
6711
6717
|
window.location.href = successRedirect;
|
|
6712
6718
|
}
|
|
6719
|
+
else {
|
|
6720
|
+
debugLog(config, "CallbackHandler", "No successRedirect or onSuccess provided - user will remain on callback page");
|
|
6721
|
+
}
|
|
6713
6722
|
}, 100);
|
|
6714
6723
|
};
|
|
6715
6724
|
useEffect(() => {
|
|
@@ -6775,8 +6784,8 @@ const PasskeymeCallbackHandler = ({ loadingComponent: LoadingComponent, errorCom
|
|
|
6775
6784
|
// Mark callback as processed to prevent re-execution
|
|
6776
6785
|
callbackProcessedRef.current = true;
|
|
6777
6786
|
if (!shouldPrompt) {
|
|
6778
|
-
// Proceed with normal redirect
|
|
6779
|
-
proceedWithRedirect();
|
|
6787
|
+
// Proceed with normal redirect, pass user directly to avoid state timing issues
|
|
6788
|
+
proceedWithRedirect(authenticatedUser);
|
|
6780
6789
|
}
|
|
6781
6790
|
}
|
|
6782
6791
|
catch (err) {
|
|
@@ -6826,8 +6835,8 @@ const PasskeymeCallbackHandler = ({ loadingComponent: LoadingComponent, errorCom
|
|
|
6826
6835
|
// Mark callback as processed to prevent re-execution
|
|
6827
6836
|
callbackProcessedRef.current = true;
|
|
6828
6837
|
if (!shouldPrompt) {
|
|
6829
|
-
// Proceed with normal redirect
|
|
6830
|
-
proceedWithRedirect();
|
|
6838
|
+
// Proceed with normal redirect, pass user directly to avoid state timing issues
|
|
6839
|
+
proceedWithRedirect(authenticatedUser);
|
|
6831
6840
|
}
|
|
6832
6841
|
}
|
|
6833
6842
|
catch (err) {
|