@base44-preview/sdk 0.8.44-pr.263.808bbc2 → 0.8.44-pr.264.d146bf4

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.
@@ -53,6 +53,19 @@ function loginViaPopup(url, redirectUrl, expectedOrigin) {
53
53
  }, 500);
54
54
  window.addEventListener("message", onMessage);
55
55
  }
56
+ function removeStoredAccessToken() {
57
+ if (typeof window === "undefined" || !window.localStorage) {
58
+ return;
59
+ }
60
+ try {
61
+ window.localStorage.removeItem("base44_access_token");
62
+ // "token" is the key the platform-v2 built-in SDK used
63
+ window.localStorage.removeItem("token");
64
+ }
65
+ catch (e) {
66
+ console.error("Failed to remove token from localStorage:", e);
67
+ }
68
+ }
56
69
  /**
57
70
  * Creates the auth module for the Base44 SDK.
58
71
  *
@@ -115,7 +128,9 @@ export function createAuthModule(axios, functionsAxiosClient, appId, options) {
115
128
  : window.location.href;
116
129
  // Build the login URL
117
130
  const loginUrl = `${options.appBaseUrl}/login?from_url=${encodeURIComponent(redirectUrl)}`;
118
- // Redirect to the login page
131
+ // The login page must not boot with the token that just got us here,
132
+ // or a rejected token redirects to /login forever.
133
+ removeStoredAccessToken();
119
134
  window.location.href = loginUrl;
120
135
  },
121
136
  // Redirects the user to a provider's login page
@@ -154,17 +169,7 @@ export function createAuthModule(axios, functionsAxiosClient, appId, options) {
154
169
  hasAccessToken = false;
155
170
  // Only do the rest if in a browser environment
156
171
  if (typeof window !== "undefined") {
157
- // Remove token from localStorage
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
- }
172
+ removeStoredAccessToken();
168
173
  // Determine the from_url parameter
169
174
  const fromUrl = redirectUrl || window.location.href;
170
175
  // 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.263.808bbc2",
3
+ "version": "0.8.44-pr.264.d146bf4",
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"