Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { createAxiosClient } from "./utils/axios-client.js";
import { createEntitiesModule } from "./modules/entities.js";
import { createIntegrationsModule } from "./modules/integrations.js";
import { createAuthModule } from "./modules/auth.js";
import { createSsoModule } from "./modules/sso.js";
import { getAccessToken } from "./utils/auth-utils.js";
import { createFunctionsModule } from "./modules/functions.js";

Expand Down Expand Up @@ -84,6 +85,7 @@ export function createClient(config: {
const serviceRoleModules = {
entities: createEntitiesModule(serviceRoleAxiosClient, appId),
integrations: createIntegrationsModule(serviceRoleAxiosClient, appId),
sso: createSsoModule(serviceRoleAxiosClient, appId),
functions: createFunctionsModule(serviceRoleFunctionsAxiosClient, appId),
};

Expand Down
8 changes: 0 additions & 8 deletions src/modules/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,6 @@ export function createAuthModule(
async me() {
return axios.get(`/apps/${appId}/entities/User/me`);
},
/**
* Get current user sso access token
* @returns {Promise<Object>} Current user sso access_token
*/
async getSsoAccessToken() {
return axios.get(`/apps/${appId}/auth/sso/accesstoken`);
},

/**
* Update current user data
* @param {Object} data - Updated user data
Expand Down
24 changes: 24 additions & 0 deletions src/modules/sso.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { AxiosInstance } from "axios";

/**
* Creates the SSO module for the Base44 SDK
* @param {import('axios').AxiosInstance} axios - Axios instance
* @param {string} appId - Application ID
* @returns {Object} SSO module with SSO authentication methods
*/
export function createSsoModule(
axios: AxiosInstance,
appId: string
) {
return {
/**
* Get current user sso access token
* @param {string} userid - User ID to include as path parameter
* @returns {Promise<Object>} Current user sso access_token
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can remove the types in the jsdoc, they'll come from typescript.
Wanna add the type of the response? is it Promise<{ access_token: string }>?

*/
async getAccessToken(userid: string) {
const url = `/apps/${appId}/auth/sso/accesstoken/${userid}`;
return axios.get(url);
},
};
}