@base44-preview/sdk 0.8.18-pr.89.3725918 → 0.8.18-pr.91.87dab3a
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/README.md +8 -8
- package/dist/modules/auth.js +17 -19
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,13 +21,13 @@ npm install @base44/sdk
|
|
|
21
21
|
|
|
22
22
|
The SDK provides access to Base44's functionality through the following modules:
|
|
23
23
|
|
|
24
|
-
- **[`agents`](https://docs.base44.com/sdk
|
|
25
|
-
- **[`app-logs`](https://docs.base44.com/sdk
|
|
26
|
-
- **[`auth`](https://docs.base44.com/sdk
|
|
27
|
-
- **[`connectors`](https://docs.base44.com/sdk
|
|
28
|
-
- **[`entities`](https://docs.base44.com/sdk
|
|
29
|
-
- **[`functions`](https://docs.base44.com/sdk
|
|
30
|
-
- **[`integrations`](https://docs.base44.com/sdk
|
|
24
|
+
- **[`agents`](https://docs.base44.com/developers/references/sdk/docs/interfaces/agents)**: Interact with AI agents and manage conversations.
|
|
25
|
+
- **[`app-logs`](https://docs.base44.com/developers/references/sdk/docs/interfaces/app-logs)**: Access and query app logs.
|
|
26
|
+
- **[`auth`](https://docs.base44.com/developers/references/sdk/docs/interfaces/auth)**: Manage user authentication, registration, and session handling.
|
|
27
|
+
- **[`connectors`](https://docs.base44.com/developers/references/sdk/docs/interfaces/connectors)**: Manage OAuth connections and access tokens for third-party services.
|
|
28
|
+
- **[`entities`](https://docs.base44.com/developers/references/sdk/docs/interfaces/entities)**: Work with your app's data entities using CRUD operations.
|
|
29
|
+
- **[`functions`](https://docs.base44.com/developers/references/sdk/docs/interfaces/functions)**: Execute backend functions.
|
|
30
|
+
- **[`integrations`](https://docs.base44.com/developers/references/sdk/docs/type-aliases/integrations)**: Pre-built integrations for external services.
|
|
31
31
|
|
|
32
32
|
## Quick starts
|
|
33
33
|
|
|
@@ -97,7 +97,7 @@ Deno.serve(async (req) => {
|
|
|
97
97
|
|
|
98
98
|
## Learn more
|
|
99
99
|
|
|
100
|
-
For complete documentation, guides, and API reference, visit the **[Base44 SDK Documentation](https://docs.base44.com/
|
|
100
|
+
For complete documentation, guides, and API reference, visit the **[Base44 SDK Documentation](https://docs.base44.com/developers/landing)**.
|
|
101
101
|
|
|
102
102
|
## Development
|
|
103
103
|
|
package/dist/modules/auth.js
CHANGED
|
@@ -45,29 +45,27 @@ export function createAuthModule(axios, functionsAxiosClient, appId, options) {
|
|
|
45
45
|
window.location.href = loginUrl;
|
|
46
46
|
},
|
|
47
47
|
// Logout the current user
|
|
48
|
-
// Removes the token from localStorage and optionally redirects to a URL or reloads the page
|
|
49
48
|
logout(redirectUrl) {
|
|
50
|
-
// Remove token from axios headers
|
|
49
|
+
// Remove token from axios headers (always do this)
|
|
51
50
|
delete axios.defaults.headers.common["Authorization"];
|
|
52
|
-
//
|
|
53
|
-
if (typeof window !== "undefined" && window.localStorage) {
|
|
54
|
-
try {
|
|
55
|
-
window.localStorage.removeItem("base44_access_token");
|
|
56
|
-
// Remove "token" that is set by the built-in SDK of platform version 2
|
|
57
|
-
window.localStorage.removeItem("token");
|
|
58
|
-
}
|
|
59
|
-
catch (e) {
|
|
60
|
-
console.error("Failed to remove token from localStorage:", e);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
// Redirect if a URL is provided
|
|
51
|
+
// Only do the rest if in a browser environment
|
|
64
52
|
if (typeof window !== "undefined") {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
53
|
+
// Remove token from localStorage
|
|
54
|
+
if (window.localStorage) {
|
|
55
|
+
try {
|
|
56
|
+
window.localStorage.removeItem("base44_access_token");
|
|
57
|
+
// Remove "token" that is set by the built-in SDK of platform version 2
|
|
58
|
+
window.localStorage.removeItem("token");
|
|
59
|
+
}
|
|
60
|
+
catch (e) {
|
|
61
|
+
console.error("Failed to remove token from localStorage:", e);
|
|
62
|
+
}
|
|
70
63
|
}
|
|
64
|
+
// Determine the from_url parameter
|
|
65
|
+
const fromUrl = redirectUrl || window.location.href;
|
|
66
|
+
// Redirect to server-side logout endpoint to clear HTTP-only cookies
|
|
67
|
+
const logoutUrl = `${options.serverUrl}/api/apps/${appId}/auth/logout?from_url=${encodeURIComponent(fromUrl)}`;
|
|
68
|
+
window.location.href = logoutUrl;
|
|
71
69
|
}
|
|
72
70
|
},
|
|
73
71
|
// Set authentication token
|