File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
packages/providers/mgt-teams-msal2-provider/src Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -424,7 +424,7 @@ export class TeamsMsal2Provider extends Msal2Provider {
424424 if ( ! this . teamsContext && TeamsHelper . microsoftTeamsLib ) {
425425 const teams = TeamsHelper . microsoftTeamsLib ;
426426 teams . initialize ( ) ;
427- this . teamsContext = await teams . getContext ( ) ;
427+ this . teamsContext = await this . getTeamsContext ( ) ;
428428 }
429429
430430 const scopes = options ? options . scopes || this . scopes : this . scopes ;
@@ -560,6 +560,20 @@ export class TeamsMsal2Provider extends Msal2Provider {
560560 } ) ;
561561 }
562562
563+ /**
564+ * Retrieves the Teams context
565+ */
566+ private async getTeamsContext ( ) {
567+ return new Promise ( resolve => {
568+ const teams = TeamsHelper . microsoftTeamsLib ;
569+ teams . initialize ( ) ;
570+ teams . getContext ( context => {
571+ resolve ( context ) ;
572+ return ;
573+ } ) ;
574+ } ) ;
575+ }
576+
563577 private unhandledFetchError ( err : any ) {
564578 console . error ( `There was an error during the server side token exchange: ${ err } ` ) ;
565579 }
You can’t perform that action at this time.
0 commit comments