-
Notifications
You must be signed in to change notification settings - Fork 1k
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
- Clear local storage and cache
- Turn on Apple ITP and Allow Popups
- Start a completely new browser session in Safari
Expected behavior
The AAD Token is fetched with no error thrown.