Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception is thrown when using msal-browser for NAA in Outlook desktop #7451

Open
2 tasks
dariussantaras opened this issue Dec 6, 2024 · 0 comments
Open
2 tasks
Labels
bug-unconfirmed A reported bug that needs to be investigated and confirmed msal-browser Related to msal-browser package Needs: Attention 👋 Awaiting response from the MSAL.js team public-client Issues regarding PublicClientApplications question Customer is asking for a clarification, use case or information.

Comments

@dariussantaras
Copy link

Core Library

MSAL.js (@azure/msal-browser)

Core Library Version

3.27.0

Wrapper Library

Not Applicable

Wrapper Library Version

None

Public or Confidential Client?

Public

Description

I have set up NAA in an Outlook Add-in as per documentation here. When I create a client (createNestablePublicClientApplication()), it throws an exception during the initialization in the Outlook desktop classic (Current Channel, Version 2411 Build 18227.20138) application.

It is only reproducible in the latest msal-browser (v3.27.0) and the reason for it may be this change. It tries to determine if the runtime is a browser environment by checking if window is defined and then goes on to call window.location.href. Outlook desktop classic client for some wild reason defines window, but not window.location, causing the initialization to blow up.
There's no easy way for me to get any more (js) logs either, because it's not an actual browser.
Also, note that this only happens on event based activation, not the taskpane.

Error Message

TypeError: Cannot read properties of undefined (reading 'href')

MSAL Logs

Due to the runtime environment, I do not have access to the console and cannot get any logs. I provided a detailed description on the error cause.

Network Trace (Preferrably Fiddler)

  • Sent
  • Pending

MSAL Configuration

{
	auth: {
		clientId: applicationId,
		authority: 'https://login.microsoftonline.com/common',
	}
}

Relevant Code Snippets

const pca = await createNestablePublicClientApplication({
	auth: {
		clientId: applicationId,
		authority: 'https://login.microsoftonline.com/common',
	},
});

Reproduction Steps

  1. Set up an Outlook add-in to get an NAA token on event-based activation
  2. Run the add-in on Outlook desktop client
  3. Add-in runs and throws an exception when initializing

Expected Behavior

The initialization should not throw an exception.

Identity Provider

Entra ID (formerly Azure AD) / MSA

Browsers Affected (Select all that apply)

Other

Regression

@azure/msal-browser 3.26.0

@dariussantaras dariussantaras added bug-unconfirmed A reported bug that needs to be investigated and confirmed question Customer is asking for a clarification, use case or information. labels Dec 6, 2024
@github-actions github-actions bot added msal-browser Related to msal-browser package public-client Issues regarding PublicClientApplications labels Dec 6, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: Attention 👋 Awaiting response from the MSAL.js team label Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-unconfirmed A reported bug that needs to be investigated and confirmed msal-browser Related to msal-browser package Needs: Attention 👋 Awaiting response from the MSAL.js team public-client Issues regarding PublicClientApplications question Customer is asking for a clarification, use case or information.
Projects
None yet
Development

No branches or pull requests

1 participant