sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

SPFx aadHttpclient fails on iphone

Open ag0059985 opened this issue 2 years ago • 7 comments

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
  • [X] 💥 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
  • SPFx version
  • Node.js version
  • etc

Describe the bug / error

We have webparts which are using graph api and custom api, which is secured using Azure AD. When we place these webparts in a SharePoint online page, and try to open it Edge browser on iphone, page refreshes multiple times. Example - If we put 4 different webparts instance on the page, page refresh happens 4 times, and with each refresh, one webpart starts working.

Steps to reproduce

  1. Create a webpart which uses graph api or custom api (secured by Azure AD)
  2. Host the webpart on SPO page
  3. Open the page on Edge browser on iPhone

Expected behavior

Page should not refresh, and all webparts should work on the first page load.

ag0059985 avatar Jan 03 '24 11:01 ag0059985

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

ghost avatar Jan 03 '24 11:01 ghost

It's because Safari blocks third party cookies by default (in iOS, all browsers use Safari behind the scenes) and eventually all browsers will be blocking the cookies. The same issue occurs when using Safari on MacOS and Firefox when certain settings are enabled. Check out the reply in this post for the most recent status update https://github.com/SharePoint/sp-dev-docs/issues/9301

kbeeveer46 avatar Jan 03 '24 23:01 kbeeveer46

Hi @kbeeveer46, thank you for the response. yes, i am aware of it on macOS, and its been resolved. but we are using edge browser on iphones, and strange thing is, each time page refreshes, one of the webpart starts working. so if on the page we have 4 different webparts, pages reloads 4 times, and than all webparts are working fine. we are following this link from MS for webpart implementation https://learn.microsoft.com/en-us/sharepoint/dev/spfx/use-aadhttpclient#connect-to-azure-ad-applications-using-the-aadhttpclient

ag0059985 avatar Jan 04 '24 05:01 ag0059985

It doesn't matter if you are using Edge, Chrome, or Firefox (or any browser) on iOS. They are all using the same WebKit rendering engine as Safari. They all block third party cookies by default. You have to disable the setting within the browser to allow it (I think it's called cross site tracking). If you don't disable it, the browser has to do a full page refresh for the authentication which means every API calls has to refresh the page.

Here is an article that explains how all browsers are the same on iOS https://9to5mac.com/2023/02/07/new-iphone-browsers/

kbeeveer46 avatar Jan 04 '24 05:01 kbeeveer46

thanks @kbeeveer46 for the help. i have disabled the cross site tracking on Safari and Edge browser both, and things are looking good. will do one more round of testing, before closing the issue.

ag0059985 avatar Jan 04 '24 06:01 ag0059985

kbeeveer46

Useful and promising to see Microsoft are looking to change their implementation. @nick-pape back on your comment in this closed issue #9301 are you able to provide any clearer timelines for when the new auth flow will be ready?

AtDH01 avatar Jan 04 '24 08:01 AtDH01

Thank you for taking the time to file an issue. We periodically archive older or inactive issues as part of our issue management process, which automatically closes them once they are archived.

If you’d like to understand more about why and how we handle archived (closed) issues, please see Our approach to closed issues.

We appreciate your contribution and if this is still an active issue with the latest SPFx versions, please do resubmit the details. We needed to perform a cleanup, so that we can start with a clean table with a new process. We apologize for the inconvenience this might cause.

github-actions[bot] avatar May 03 '25 16:05 github-actions[bot]