Forum Discussion
matt131
Oct 07, 2020Copper Contributor
microsoftTeams.authentication.authenticate inconsistent behavior
I'm using the following:
microsoftTeams.initialize()
microsoftTeams.authentication.authenticate({
url: redirectUrl,
width: 500,
height: 500,
successCallback: () => {
alert('success';
},
failureCallback: () => {
alert('failed');
},
});
This works prefectly as expcted when using teams in the browser. However in the Mac desktop client, when I first click sign in and run the above code, it launches an external browser instead of the popup. Sometimes on the 2nd or 3rd attempt it will then open the popup.
I saw reference to waiting for initalization to complete with the following:
microsoftTeams.initialize(() => {
// Initialization complete
});
But this does not appear to work at all. Any tips or things I may be overlooking?
- Varaprasad-MSFTMicrosoft
matt131 , You need to wait for the initialization to complete before making the authenticate call.
microsoftTeams.initialize(() => { microsoftTeams.authentication.authenticate({ url: redirectUrl, width: 500, height: 500, successCallback: () => { alert('success'; }, failureCallback: () => { alert('failed'); }, }); });