What is the proper approach to handling MSAL authentication in an Outlook Add-in on Android?

Nazar Serdiuk 0 Reputation points
2025-03-06T20:02:38.0833333+00:00

Hello,

I am developing an Outlook Add-in that requires MSAL authentication. The Add-in is a React app created with the Yeoman generator, and I am using the msal-react library for authentication.

To authenticate users, I use the loginPopup method of an MSAL instance. This approach works as expected on the web, iOS (where it redirects within the Outlook internal browser), and desktop applications.

However, I am encountering an issue on the Android version of the Outlook app. Instead of opening an in-app browser (as it does on iOS), loginPopup redirects users to an external browser for authentication. After logging in, users are not redirected back to the Outlook app. Instead, they are taken to the redirectUri specified in my MSAL configuration, which points to a webpage where my Add-in's source files are hosted.

My question is:

Do I need to specify a different redirectUri to ensure the user is redirected back to the Outlook app and properly authenticated within the Add-in?

Is there a recommended approach that ensures consistent behavior across all platforms (web, iOS, desktop, and Android)?

I would appreciate any guidance or best practices for handling this scenario.

Thank you!

Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
4,313 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Nazar Serdiuk 0 Reputation points
    2025-03-09T21:16:34.1033333+00:00

    I was able to fix the issue by migrating from "regular" app authentication to Nested App Authentication (NAA).

    NAA is specifically designed for "nested" applications like Office add-ins, ensuring a seamless sign-in experience without redirecting users to an external browser. After making this change, my authentication flow worked correctly across all platforms.

    🔗 Microsoft Docs: Enable Nested App Authentication

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.