@base44/sdk 0.6.1 → 0.7.0
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/client.js +1 -1
- package/dist/modules/sso.d.ts +3 -1
- package/dist/modules/sso.js +9 -2
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -66,7 +66,7 @@ export function createClient(config) {
|
|
|
66
66
|
const serviceRoleModules = {
|
|
67
67
|
entities: createEntitiesModule(serviceRoleAxiosClient, appId),
|
|
68
68
|
integrations: createIntegrationsModule(serviceRoleAxiosClient, appId),
|
|
69
|
-
sso: createSsoModule(serviceRoleAxiosClient, appId),
|
|
69
|
+
sso: createSsoModule(serviceRoleAxiosClient, appId, token),
|
|
70
70
|
functions: createFunctionsModule(serviceRoleFunctionsAxiosClient, appId),
|
|
71
71
|
};
|
|
72
72
|
// Always try to get token from localStorage or URL parameters
|
package/dist/modules/sso.d.ts
CHANGED
|
@@ -3,9 +3,11 @@ import { AxiosInstance } from "axios";
|
|
|
3
3
|
* Creates the SSO module for the Base44 SDK
|
|
4
4
|
* @param {import('axios').AxiosInstance} axios - Axios instance
|
|
5
5
|
* @param {string} appId - Application ID
|
|
6
|
+
* @param {string} [userToken] - User authentication token
|
|
7
|
+
* @param {string} [serviceToken] - Service role authentication token
|
|
6
8
|
* @returns {Object} SSO module with SSO authentication methods
|
|
7
9
|
*/
|
|
8
|
-
export declare function createSsoModule(axios: AxiosInstance, appId: string): {
|
|
10
|
+
export declare function createSsoModule(axios: AxiosInstance, appId: string, userToken?: string): {
|
|
9
11
|
/**
|
|
10
12
|
* Get current user sso access token
|
|
11
13
|
* @param {string} userid - User ID to include as path parameter
|
package/dist/modules/sso.js
CHANGED
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
* Creates the SSO module for the Base44 SDK
|
|
3
3
|
* @param {import('axios').AxiosInstance} axios - Axios instance
|
|
4
4
|
* @param {string} appId - Application ID
|
|
5
|
+
* @param {string} [userToken] - User authentication token
|
|
6
|
+
* @param {string} [serviceToken] - Service role authentication token
|
|
5
7
|
* @returns {Object} SSO module with SSO authentication methods
|
|
6
8
|
*/
|
|
7
|
-
export function createSsoModule(axios, appId) {
|
|
9
|
+
export function createSsoModule(axios, appId, userToken) {
|
|
8
10
|
return {
|
|
9
11
|
/**
|
|
10
12
|
* Get current user sso access token
|
|
@@ -13,7 +15,12 @@ export function createSsoModule(axios, appId) {
|
|
|
13
15
|
*/
|
|
14
16
|
async getAccessToken(userid) {
|
|
15
17
|
const url = `/apps/${appId}/auth/sso/accesstoken/${userid}`;
|
|
16
|
-
|
|
18
|
+
// Prepare headers with both tokens if available
|
|
19
|
+
const headers = {};
|
|
20
|
+
if (userToken) {
|
|
21
|
+
headers['on-behalf-of'] = `Bearer ${userToken}`;
|
|
22
|
+
}
|
|
23
|
+
return axios.get(url, { headers });
|
|
17
24
|
},
|
|
18
25
|
};
|
|
19
26
|
}
|