@@ -56,7 +56,7 @@ import AuthAPI from './__temp__/api';
5656import getMeOrganizations from './api/getMeOrganizations' ;
5757import getScim2Me from './api/getScim2Me' ;
5858import getSchemas from './api/getSchemas' ;
59- import { AsgardeoReactConfig } from './models/config' ;
59+ import { AsgardeoReactConfig } from './models/config' ;
6060import getAllOrganizations from './api/getAllOrganizations' ;
6161
6262/**
@@ -107,7 +107,7 @@ class AsgardeoReactClient<T extends AsgardeoReactConfig = AsgardeoReactConfig> e
107107 }
108108
109109 return this . withLoading ( async ( ) => {
110- return this . asgardeo . init ( { ...config , organizationHandle : resolvedOrganizationHandle } as any ) ;
110+ return this . asgardeo . init ( { ...config , organizationHandle : resolvedOrganizationHandle } as any ) ;
111111 } ) ;
112112 }
113113
@@ -145,8 +145,8 @@ class AsgardeoReactClient<T extends AsgardeoReactConfig = AsgardeoReactConfig> e
145145 baseUrl = configData ?. baseUrl ;
146146 }
147147
148- const profile = await getScim2Me ( { baseUrl} ) ;
149- const schemas = await getSchemas ( { baseUrl} ) ;
148+ const profile = await getScim2Me ( { baseUrl } ) ;
149+ const schemas = await getSchemas ( { baseUrl } ) ;
150150
151151 return generateUserProfile ( profile , flattenUserSchema ( schemas ) ) ;
152152 } catch ( error ) {
@@ -160,6 +160,12 @@ class AsgardeoReactClient<T extends AsgardeoReactConfig = AsgardeoReactConfig> e
160160 } ) ;
161161 }
162162
163+ async getIdToken ( ) : Promise < string > {
164+ return this . withLoading ( async ( ) => {
165+ return this . asgardeo . getIdToken ( ) ;
166+ } ) ;
167+ }
168+
163169 async getUserProfile ( options ?: any ) : Promise < UserProfile > {
164170 return this . withLoading ( async ( ) => {
165171 try {
@@ -170,8 +176,8 @@ class AsgardeoReactClient<T extends AsgardeoReactConfig = AsgardeoReactConfig> e
170176 baseUrl = configData ?. baseUrl ;
171177 }
172178
173- const profile = await getScim2Me ( { baseUrl} ) ;
174- const schemas = await getSchemas ( { baseUrl} ) ;
179+ const profile = await getScim2Me ( { baseUrl } ) ;
180+ const schemas = await getSchemas ( { baseUrl } ) ;
175181
176182 const processedSchemas = flattenUserSchema ( schemas ) ;
177183
@@ -201,11 +207,10 @@ class AsgardeoReactClient<T extends AsgardeoReactConfig = AsgardeoReactConfig> e
201207 baseUrl = configData ?. baseUrl ;
202208 }
203209
204- return getMeOrganizations ( { baseUrl} ) ;
210+ return getMeOrganizations ( { baseUrl } ) ;
205211 } catch ( error ) {
206212 throw new AsgardeoRuntimeError (
207- `Failed to fetch the user's associated organizations: ${
208- error instanceof Error ? error . message : String ( error )
213+ `Failed to fetch the user's associated organizations: ${ error instanceof Error ? error . message : String ( error )
209214 } `,
210215 'AsgardeoReactClient-getMyOrganizations-RuntimeError-001' ,
211216 'react' ,
@@ -223,7 +228,7 @@ class AsgardeoReactClient<T extends AsgardeoReactConfig = AsgardeoReactConfig> e
223228 baseUrl = configData ?. baseUrl ;
224229 }
225230
226- return getAllOrganizations ( { baseUrl} ) ;
231+ return getAllOrganizations ( { baseUrl } ) ;
227232 } catch ( error ) {
228233 throw new AsgardeoRuntimeError (
229234 `Failed to fetch all organizations: ${ error instanceof Error ? error . message : String ( error ) } ` ,
@@ -282,7 +287,7 @@ class AsgardeoReactClient<T extends AsgardeoReactConfig = AsgardeoReactConfig> e
282287 signInRequired : true ,
283288 } ;
284289
285- return ( await this . asgardeo . exchangeToken ( exchangeConfig , ( user : User ) => { } ) ) as TokenResponse | Response ;
290+ return ( await this . asgardeo . exchangeToken ( exchangeConfig , ( user : User ) => { } ) ) as TokenResponse | Response ;
286291 } catch ( error ) {
287292 throw new AsgardeoRuntimeError (
288293 `Failed to switch organization: ${ error . message || error } ` ,
@@ -315,7 +320,7 @@ class AsgardeoReactClient<T extends AsgardeoReactConfig = AsgardeoReactConfig> e
315320 sessionId ?: string ,
316321 ) : Promise < TokenResponse | Response > {
317322 return this . withLoading ( async ( ) => {
318- return this . asgardeo . exchangeToken ( config , ( user : User ) => { } ) as unknown as TokenResponse | Response ;
323+ return this . asgardeo . exchangeToken ( config , ( user : User ) => { } ) as unknown as TokenResponse | Response ;
319324 } ) ;
320325 }
321326
@@ -423,7 +428,7 @@ class AsgardeoReactClient<T extends AsgardeoReactConfig = AsgardeoReactConfig> e
423428 baseUrl,
424429 payload :
425430 typeof firstArg === 'object' && 'flowType' in firstArg
426- ? { ...( firstArg as EmbeddedFlowExecuteRequestPayload ) , verbose : true }
431+ ? { ...( firstArg as EmbeddedFlowExecuteRequestPayload ) , verbose : true }
427432 : ( firstArg as EmbeddedFlowExecuteRequestPayload ) ,
428433 } ) as any ;
429434 }
0 commit comments