Open
Description
When trying to open an SSO tab app in Microsoft 365 Copilot for the first time, an 'Windows auth not available' error occurs. If you close Microsoft 365 Copilot and open it again, everything works fine.
Steps to reproduce:
- Install Microsoft 365 Copilot from the Microsoft Store
- Open Microsoft 365 Copilot and login with a Microsoft professional account
- Install an SSO tab app
- Run the app
- You will see the error message 'Windows auth not available'
The code:
import { app, authentication } from '@microsoft/teams-js';
try {
console.log('authenticate');
await app.initialize();
console.log('app initialized');
const context = await app.getContext();
console.log('context', context);
const msalInstance = new PublicClientApplication({
auth: {
clientId: import.meta.env.VITE_MICROSOFT_CLIENT_ID,
authority: `${import.meta.env.VITE_MICROSOFT_OAUTH2_BASE_URL}/${context.user.tenant.id}`,
navigateToLoginRequestUrl: false,
},
cache: {
cacheLocation: 'sessionStorage',
},
});
console.log('msalInstance', msalInstance);
console.log('getMsalInstance');
setIsInMicrosoftTeams();
console.log('setIsInMicrosoftTeams');
const token = await authentication.getAuthToken();
console.log('token', token);
const response = await fetch(...);
console.log('response', response);
window.location.replace(...);
} catch (error) {
console.error('CATCH ERROR', error);
}