database-petani-mobile/node_modules/@base44/sdk/dist/modules/sso.js
2026-02-23 16:39:35 +07:00

24 lines
740 B
JavaScript

/**
* Creates the SSO module for the Base44 SDK.
*
* @param axios - Axios instance
* @param appId - Application ID
* @param userToken - User authentication token
* @returns SSO module with authentication methods
* @internal
*/
export function createSsoModule(axios, appId, userToken) {
return {
// Get SSO access token for a specific user
async getAccessToken(userid) {
const url = `/apps/${appId}/auth/sso/accesstoken/${userid}`;
// Prepare headers with both tokens if available
const headers = {};
if (userToken) {
headers["on-behalf-of"] = `Bearer ${userToken}`;
}
return axios.get(url, { headers });
},
};
}