Forum Discussion

hrachocode's avatar
hrachocode
Copper Contributor
Oct 25, 2020

microsoftTeams.authentication.authenticate does not close popup, neither success nor failure message

I am using microsoftTeams.authentication.authenticate way of authentication, with popup

 

1. everything is fine and popup appears with sepcified URL

2. authentication is completed and it returns to my redirect URL with url parameters

 

after I am calling microsoftTeams.authentication.notifySuccess('message');

but popup remains opened and doing nothing. am I need to do something to manually close popup or it should close automatically?

 

popup function

 

export const requestConsent = (res) => {
      return new Promise((resolve, reject) => {
            microsoftTeams.authentication.authenticate({
                  url: res,
                  width: 600,
                  height: 535,
                  successCallback: function (result) {
                        resolve(result)
                  },
                  failureCallback: function (reason) {
                        if (typeof reason === 'string') {
                              reject(reason)
                        };
                  }
            });
      });
}

 

 

callng function

 

 requestConsent(resLocal)
                  .then((result) => {
                        dispatch(setToken(result));
                        console.log(result);
                  })
                  .catch((error) => {
                        dispatch(setSnackbarMessage(error));
                        console.log(error);
                  })
                  .finally(resFinal => console.log(resFinal));

 

 

and finally calling microsoftTeams.authentication.notifySuccess

 

microsoftTeams.initializate() is called as well, in project root file.

Resources