Forum Discussion

bmedenwald's avatar
bmedenwald
Copper Contributor
May 22, 2024

Teams App Won't Authenticate in New Outlook

I have a Teams app that is about to be upgraded to the new manifest so it will run in Outlook. I uploaded the app to test it, and in the old Outlook it works fine. I can see the interface, click the button to authenticate with my cloud system, it pops up a small window inside Outlook, I authenticate, and it works. Just like Teams.

 

If a switch to the New Outlook, it doesn't work. I can still see the interface, but when I click the button to authenticate with my cloud system it does not pop up a small window inside Outlook. Instead it send me to the web browser. This will always fail as the Teams JS requires Outlook to be notified of the success in the small window it must provide (like old Outlook and Teams does).

 

How can I get this to work? We've had reports among our customers in the past that this happens in Teams and the only thing I've ever seen work is to log out of Teams entirely. But in Outlook that's not an option. I've tried to repair and reset Outlook via the Settings app in Windows to no avail.

 

 

    • Sayali-MSFT's avatar
      Sayali-MSFT
      Icon for Microsoft rankMicrosoft
      Sorry for delay in response,we are actively checking with engineering team,we will let you know once we have any update.
      • bmedenwald's avatar
        bmedenwald
        Copper Contributor
        Are you able to respond with a timeframe for when you'll have more information? Our integration is entirely broken. Not a little, entirely broken. I'm happy to hop on a call if it helps, but we need this fixed today. It's been MONTHS.
  • bmedenwald 

     

    Better to check with Microsoft support but at least new Outlook has its own moves, it prefers web browsers for authentication to my understanding

    • bmedenwald's avatar
      bmedenwald
      Copper Contributor

      Kidd_Ip That cannot be true. If it is, then Microsoft Teams JS 2.0 is completely broken. It relies exclusively on a popup for authentication in the app itself. Works in old Outlook, old Teams, new Teams.

      • bmedenwald's avatar
        bmedenwald
        Copper Contributor

        For everyone's knowledge, our integration is out there now and just as broken.

         

        Works in:

        - Old Outlook

        - Old Teams

        - New Teams

        - Microsoft 365

        - Teams in the web browser

         

        But, it does not work in "New" Outlook. Steps to reproduce:

         

        - Hop into "New" Outlook on Windows

        - Find the "Simple In/Out" app in the App Store

        - When you go to the tab, there is a button to sign in. This button MUST pop up a window inside Outlook for Teams JS 2.x to authenticate. If you click that button to Log In and get shoved to a web browser, that's the bug because Microsoft's Teams JS requires a method be called in the app itself to trigger the end of the authentication cycle.

         

        If you don't understand how this works, please follow the same steps above inside Teams and see how it is supposed to work.

         

        I now have customers complaining because it's getting hard to downgrade to old Outlook. HELP!

  • Hello bmedenwald - Thanks for raising your query.
    Could you please share repro steps and details so that we can quickly check your issue ? (Code, Manifest package and logs if possible)
    • bmedenwald's avatar
      bmedenwald
      Copper Contributor
      The reproduction steps are:

      1. Upload an app that uses Microsoft Teams JS v2.x for authentication.
      2. Load the app in the Outlook interface, which presents a login button in our interface.
      3. Click the login button

      In traditional Outlook, this pops up a little window to authenticate, per the Teams JS library's behavior. In the new Outlook, this sends the user to a webpage which is a broken behavior as the Teams JS promise cannot be resolved in a web browser.

      I can probably provide a test manifest on request that would reproduce, though I assume this is an often-used use case no?

      When I call Teams JS v2 "authenticate" method I am not passing a value for "isExternal". This has never been a problem, but did new Outlook change the default under the covers?
      • Dinesh-MSFT's avatar
        Dinesh-MSFT
        Icon for Microsoft rankMicrosoft

        Hi bmedenwald,

        To address your Teams app's authentication issue in the new Outlook client, ensure your authentication flow works in both old and new versions of Outlook. If the process redirects to a web browser instead of opening a window in Outlook, follow these steps:

        1. Update Authentication Flow: Ensure compatibility with the new Outlook client and handle authentication within Outlook itself.
        2. Use MSAL: Implement the Microsoft Authentication Library (MSAL) for seamless authentication and token acquisition.
        3. Handle Callbacks: Properly manage authentication callbacks to redirect back to Outlook after completing the process.
        4. Test and Debug: Thoroughly test in both Outlook versions and use developer tools for debugging. 

        Sample Code Snippet using MSAL:

        const msalConfig = {
         auth: {
           clientId: 'your_client_id',
           authority: 'https://login.microsoftonline.com/your_tenant_id',
         }
        };
        const msalInstance = new msal.PublicClientApplication(msalConfig);
        const loginRequest = { scopes: ['user.read'] };
        msalInstance.loginPopup(loginRequest)
         .then(response => {
           console.log('Authentication successful:', response);
         })
         .catch(error => {
           console.error('Authentication error:', error);
         });

        Please refer the MSAL Documentation and Authentication in Microsoft Teams Apps documents. These steps should resolve the authentication issue in the new Outlook client, ensuring a consistent user experience.

Resources