File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ export function createClient(config: {
8585 const serviceRoleModules = {
8686 entities : createEntitiesModule ( serviceRoleAxiosClient , appId ) ,
8787 integrations : createIntegrationsModule ( serviceRoleAxiosClient , appId ) ,
88- sso : createSsoModule ( serviceRoleAxiosClient , appId ) ,
88+ sso : createSsoModule ( serviceRoleAxiosClient , appId , token ) ,
8989 functions : createFunctionsModule ( serviceRoleFunctionsAxiosClient , appId ) ,
9090 } ;
9191
Original file line number Diff line number Diff line change @@ -4,11 +4,14 @@ import { AxiosInstance } from "axios";
44 * Creates the SSO module for the Base44 SDK
55 * @param {import('axios').AxiosInstance } axios - Axios instance
66 * @param {string } appId - Application ID
7+ * @param {string } [userToken] - User authentication token
8+ * @param {string } [serviceToken] - Service role authentication token
79 * @returns {Object } SSO module with SSO authentication methods
810 */
911export function createSsoModule (
1012 axios : AxiosInstance ,
11- appId : string
13+ appId : string ,
14+ userToken ?: string
1215) {
1316 return {
1417 /**
@@ -18,7 +21,16 @@ export function createSsoModule(
1821 */
1922 async getAccessToken ( userid : string ) {
2023 const url = `/apps/${ appId } /auth/sso/accesstoken/${ userid } ` ;
21- return axios . get ( url ) ;
24+
25+ // Prepare headers with both tokens if available
26+ const headers : Record < string , string > = { } ;
27+
28+
29+ if ( userToken ) {
30+ headers [ 'on-behalf-of' ] = `Bearer ${ userToken } ` ;
31+ }
32+
33+ return axios . get ( url , { headers } ) ;
2234 } ,
2335 } ;
2436}
You can’t perform that action at this time.
0 commit comments