@lumiapassport/ui-kit 1.16.2 → 1.16.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/iframe/index.html +1 -1
- package/dist/iframe/main.js +1 -1
- package/dist/index.cjs +27 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +27 -22
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5638,7 +5638,7 @@ function Header() {
|
|
|
5638
5638
|
// package.json
|
|
5639
5639
|
var package_default = {
|
|
5640
5640
|
name: "@lumiapassport/ui-kit",
|
|
5641
|
-
version: "1.16.
|
|
5641
|
+
version: "1.16.4",
|
|
5642
5642
|
description: "React UI components and hooks for Lumia Passport authentication and Account Abstraction",
|
|
5643
5643
|
type: "module",
|
|
5644
5644
|
main: "./dist/index.cjs",
|
|
@@ -6917,17 +6917,29 @@ function Social(props) {
|
|
|
6917
6917
|
const iframeManager = getIframeManager2();
|
|
6918
6918
|
const finalizeSocialLogin = async (rawLoginResponse, providerKey, userData) => {
|
|
6919
6919
|
let loginResponse2 = await normalizeSocialLoginResponse(rawLoginResponse, providerKey, userData);
|
|
6920
|
-
const
|
|
6921
|
-
|
|
6920
|
+
const existingAccessToken = jwtTokenManager2.getAccessToken();
|
|
6921
|
+
const existingRefreshToken = jwtTokenManager2.getRefreshToken();
|
|
6922
|
+
if (existingAccessToken && existingRefreshToken && !loginResponse2.accessToken) {
|
|
6923
|
+
console.log("[AuthModal] Using tokens already stored by iframe-manager");
|
|
6924
|
+
loginResponse2 = {
|
|
6925
|
+
...loginResponse2,
|
|
6926
|
+
accessToken: existingAccessToken,
|
|
6927
|
+
refreshToken: existingRefreshToken
|
|
6928
|
+
};
|
|
6929
|
+
}
|
|
6922
6930
|
if (!loginResponse2.accessToken || !loginResponse2.refreshToken) {
|
|
6923
|
-
const
|
|
6924
|
-
|
|
6925
|
-
|
|
6926
|
-
|
|
6927
|
-
|
|
6928
|
-
|
|
6929
|
-
|
|
6930
|
-
|
|
6931
|
+
const tokenExchangeConfig = authConfig?.tokenExchange || provider?.tokenExchange;
|
|
6932
|
+
loginResponse2 = await enrichLoginResponseWithTokens(loginResponse2, providerKey, tokenExchangeConfig);
|
|
6933
|
+
if (!loginResponse2.accessToken || !loginResponse2.refreshToken) {
|
|
6934
|
+
const refreshTokens = await fetchTokensFromRefreshEndpoint();
|
|
6935
|
+
if (refreshTokens) {
|
|
6936
|
+
loginResponse2 = {
|
|
6937
|
+
...loginResponse2,
|
|
6938
|
+
accessToken: refreshTokens.accessToken,
|
|
6939
|
+
refreshToken: refreshTokens.refreshToken,
|
|
6940
|
+
expiresIn: refreshTokens.expiresIn
|
|
6941
|
+
};
|
|
6942
|
+
}
|
|
6931
6943
|
}
|
|
6932
6944
|
}
|
|
6933
6945
|
if (!loginResponse2) {
|
|
@@ -7005,23 +7017,16 @@ function Social(props) {
|
|
|
7005
7017
|
const { user } = result;
|
|
7006
7018
|
if (normalizedProviderId === "x" || normalizedProviderId === "twitter") {
|
|
7007
7019
|
console.log("[AuthModal] X OAuth completed, user authenticated via callback");
|
|
7008
|
-
|
|
7009
|
-
const verifyUrl = addProjectIdToUrl(`${tssUrl2}/api/auth/verify`);
|
|
7010
|
-
const verifyResponse = await fetch(verifyUrl, {
|
|
7011
|
-
method: "GET",
|
|
7012
|
-
credentials: "include"
|
|
7013
|
-
});
|
|
7014
|
-
if (!verifyResponse.ok) {
|
|
7020
|
+
if (!user) {
|
|
7015
7021
|
setAlert({
|
|
7016
7022
|
title: "Authentication Failed",
|
|
7017
|
-
message: "
|
|
7023
|
+
message: "No user data received from X authentication"
|
|
7018
7024
|
});
|
|
7019
7025
|
setIsLoading(false);
|
|
7020
7026
|
return;
|
|
7021
7027
|
}
|
|
7022
|
-
|
|
7023
|
-
|
|
7024
|
-
await finalizeSocialLogin(loginResponse2, "x");
|
|
7028
|
+
console.log("[AuthModal] X login data:", user);
|
|
7029
|
+
await finalizeSocialLogin(user, "x");
|
|
7025
7030
|
return;
|
|
7026
7031
|
}
|
|
7027
7032
|
if (!user) {
|