@base44-preview/sdk 0.8.44-pr.263.808bbc2 → 0.8.44-pr.264.1c7c943
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/modules/auth.js +10 -12
- package/package.json +2 -2
package/dist/modules/auth.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { removeAccessToken } from "../utils/auth-utils.js";
|
|
1
2
|
import { resetAnalyticsSessionContext } from "./analytics.js";
|
|
2
3
|
function isInsideIframe() {
|
|
3
4
|
if (typeof window === "undefined")
|
|
@@ -53,6 +54,11 @@ function loginViaPopup(url, redirectUrl, expectedOrigin) {
|
|
|
53
54
|
}, 500);
|
|
54
55
|
window.addEventListener("message", onMessage);
|
|
55
56
|
}
|
|
57
|
+
// "token" is the key the platform-v2 built-in SDK wrote.
|
|
58
|
+
function removeStoredAccessTokens() {
|
|
59
|
+
removeAccessToken({});
|
|
60
|
+
removeAccessToken({ storageKey: "token" });
|
|
61
|
+
}
|
|
56
62
|
/**
|
|
57
63
|
* Creates the auth module for the Base44 SDK.
|
|
58
64
|
*
|
|
@@ -115,7 +121,9 @@ export function createAuthModule(axios, functionsAxiosClient, appId, options) {
|
|
|
115
121
|
: window.location.href;
|
|
116
122
|
// Build the login URL
|
|
117
123
|
const loginUrl = `${options.appBaseUrl}/login?from_url=${encodeURIComponent(redirectUrl)}`;
|
|
118
|
-
//
|
|
124
|
+
// The login page must not boot with the token that just got us here,
|
|
125
|
+
// or a rejected token redirects to /login forever.
|
|
126
|
+
removeStoredAccessTokens();
|
|
119
127
|
window.location.href = loginUrl;
|
|
120
128
|
},
|
|
121
129
|
// Redirects the user to a provider's login page
|
|
@@ -154,17 +162,7 @@ export function createAuthModule(axios, functionsAxiosClient, appId, options) {
|
|
|
154
162
|
hasAccessToken = false;
|
|
155
163
|
// Only do the rest if in a browser environment
|
|
156
164
|
if (typeof window !== "undefined") {
|
|
157
|
-
|
|
158
|
-
if (window.localStorage) {
|
|
159
|
-
try {
|
|
160
|
-
window.localStorage.removeItem("base44_access_token");
|
|
161
|
-
// Remove "token" that is set by the built-in SDK of platform version 2
|
|
162
|
-
window.localStorage.removeItem("token");
|
|
163
|
-
}
|
|
164
|
-
catch (e) {
|
|
165
|
-
console.error("Failed to remove token from localStorage:", e);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
165
|
+
removeStoredAccessTokens();
|
|
168
166
|
// Determine the from_url parameter
|
|
169
167
|
const fromUrl = redirectUrl || window.location.href;
|
|
170
168
|
// Redirect to server-side logout endpoint to clear HTTP-only cookies
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@base44-preview/sdk",
|
|
3
|
-
"version": "0.8.44-pr.
|
|
3
|
+
"version": "0.8.44-pr.264.1c7c943",
|
|
4
4
|
"description": "JavaScript SDK for Base44 API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"create-docs:process": "node scripts/mintlify-post-processing/file-processing/file-processing.js"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"axios": "1.18.1",
|
|
29
|
+
"axios": "^1.18.1",
|
|
30
30
|
"partysocket": "^0.0.23",
|
|
31
31
|
"socket.io-client": "^4.8.3",
|
|
32
32
|
"uuid": "^13.0.2"
|