MSAL Outlook Web Addin loginpopup

Dung Tran 0 Reputation points
2023-07-06T09:42:26.7733333+00:00

I am building an Outlook Web Addin in VS.

All the guides/articles that I have been following is generally saying that I need to create the msal PublicClientApplication, do the loginPopup and then get the token silently.

My problem is when i call the loginPopup, then a popup is showing but the login UI is not showing the login options (account, credentials) like many of the articles that i am following.

I have been watching this: https://www.youtube.com/watch?v=P3vkerr1nW8&t=2373s

And reading this: https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/login-user.md

When i navigate to office.com i am automatically signed in my windows work account. then i open the calendar and click new appointment. In the tab pane in the new appointment popup my addin button is showing. clicking this opens the addin to the right of the appointment popup. In this right pane the MessageRead.html is showing.
I have a button in MessageRead.html that starts all of the above. When i click it it starts the code snippets that i have attached this question.

in the loginpopup it shows:
HTTP Error 403.14 - Forbidden
The Web server is configured to not list the contents of this directory.

I tried changing the redirect uri to office.com, but then it just shows my my office.com mail.
And because the loginpopup is async then it never returns. so my code is stucked there.

And i have also added the redirect uris to the app registration in azure.

const msalConfig = {
				auth: {
					clientId: '
Outlook
Outlook
A family of Microsoft email and calendar products.
4,427 questions
JavaScript API
JavaScript API
An Office service that supports add-ins to interact with objects in Office client applications.
1,038 questions
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,226 questions
{count} votes

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.