File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -159,6 +159,12 @@ class AsgardeoReactClient<T extends AsgardeoReactConfig = AsgardeoReactConfig> e
159159 return this . asgardeo . getDecodedIdToken ( sessionId ) ;
160160 }
161161
162+ async getIdToken ( ) : Promise < string > {
163+ return this . withLoading ( async ( ) => {
164+ return this . asgardeo . getIdToken ( ) ;
165+ } ) ;
166+ }
167+
162168 async getUserProfile ( options ?: any ) : Promise < UserProfile > {
163169 return this . withLoading ( async ( ) => {
164170 try {
Original file line number Diff line number Diff line change @@ -113,6 +113,14 @@ export type AsgardeoContextProps = {
113113 */
114114 getDecodedIdToken : ( ) => Promise < IdToken > ;
115115
116+ /**
117+ * Function to retrieve the ID token.
118+ * This function retrieves the ID token and returns it.
119+ *
120+ * @returns A promise that resolves to the ID token.
121+ */
122+ getIdToken : ( ) => Promise < string > ;
123+
116124 /**
117125 * Retrieves the access token stored in the storage.
118126 * This function retrieves the access token and returns it.
@@ -167,6 +175,7 @@ const AsgardeoContext: Context<AsgardeoContextProps | null> = createContext<null
167175 } ,
168176 signInOptions : { } ,
169177 getDecodedIdToken : null ,
178+ getIdToken : null ,
170179 getAccessToken : null ,
171180 exchangeToken : null ,
172181 storage : 'sessionStorage' ,
Original file line number Diff line number Diff line change @@ -497,6 +497,10 @@ const AsgardeoProvider: FC<PropsWithChildren<AsgardeoProviderProps>> = ({
497497 return await asgardeo . getDecodedIdToken ( ) ;
498498 } , [ asgardeo ] ) ;
499499
500+ const getIdToken = useCallback ( async ( ) : Promise < string > => {
501+ return await asgardeo . getIdToken ( ) ;
502+ } , [ asgardeo ] ) ;
503+
500504 const getAccessToken = useCallback ( async ( ) : Promise < string > => {
501505 return await asgardeo . getAccessToken ( ) ;
502506 } , [ asgardeo ] ) ;
@@ -576,6 +580,7 @@ const AsgardeoProvider: FC<PropsWithChildren<AsgardeoProviderProps>> = ({
576580 reInitialize,
577581 signInOptions,
578582 getDecodedIdToken,
583+ getIdToken,
579584 exchangeToken,
580585 syncSession,
581586 platform : config ?. platform ,
You can’t perform that action at this time.
0 commit comments