SharePoint / SharePoint/sp-dev-docs

AadTokenProvider with PopUp Configuration breaking in Safari

Open
#10,380 9 comments 0 reactions 1 assignee View on GitHub

@Ashlesha-MSFT is already working on this.

Since Aug 27, 2025.

area:auth sharepoint-developer-support type:bug-confirmed type:bug-suspected
Dominant language
PowerShell
Stars
1.4k
Forks
1.1k
Avg merge
4d 12h
Merged PRs (30d)
12

Description

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

💥 SharePoint Framework

Developer environment

None

What browser(s) / client(s) have you tested
  • 💥 Internet Explorer
  • 💥 Microsoft Edge
  • 💥 Google Chrome
  • 💥 FireFox
  • 💥 Safari
  • mobile (iOS/iPadOS)
  • mobile (Android)
  • not applicable
  • other (enter in the "Additional environment details" area below)
Additional environment details
  • browser version: Safari Version 18.5 (20621.2.5.11.8)
  • Apple ITP enabled, Pop-Ups Allowed
  • SPFx version: 1.19.0
  • Node.js version: 18
Describe the bug / error

When attempting to fetch an AAD token in safari using AadTokenProvider, AadTokenProvider.getToken() fails and throws the following error:

ERROR:
undefined is not an object (evaluating 'n.name')

CALL STACK:
@https://res-1.public.onecdn.static.microsoft/files/sp-client/chunk.msalBrowser_none_204e66f4ff5f4c9a0c41.js:3:11258

The popup appears, but before it is dismisses itself, the error above is thrown by MSAL. The error seems to originate from a catch block.

This only happens on first load when the token is initially being acquired. It seems like it is successfully fetching the access token and storing it locally because upon refreshing, the error is not thrown and everything works as expected. Clearing localStorage triggers the issue again.

I could not recreate this behavior in Chrome 139.0.7258.139 regardless of Third-Party Cookie or Pop-Up settings.

Example code below

protected async onInit(): Promise<void> {

...

this._AadTokenProvider = await this.context.aadTokenProviderFactory.getTokenProvider();

this._AadTokenProvider.popupEvent.add(this, (args: IPopupEventArgs) => {
  args.cancel(); // REQUIRED: to cancel the default popup that is called to open
  args.showPopup(); // initiate the popup flow
});

//Error occurrs here
this._AadTokenProvider.getToken("https://graph.microsoft.com");

...
}
Steps to reproduce
  1. Clear local storage and cache
  2. Turn on Apple ITP and Allow Popups
  3. Start a completely new browser session in Safari
Expected behavior

The AAD Token is fetched with no error thrown.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.