Skip to content

Microsoft 365 Copilot: "Windows auth not available" in tab application #2813

Open
@maxime-wd

Description

@maxime-wd

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:

  1. Install Microsoft 365 Copilot from the Microsoft Store
  2. Open Microsoft 365 Copilot and login with a Microsoft professional account
  3. Install an SSO tab app
  4. Run the app
  5. You will see the error message 'Windows auth not available'

Image

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);
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions