SharePoint / sp-dev-docs

SharePoint & Viva Connections Developer Documentation
https://docs.microsoft.com/en-us/sharepoint/dev/
Creative Commons Attribution 4.0 International
1.25k stars 1.01k forks source link

AADTokenProvider fails to get token in new Lists UI #9886

Closed vladigubler closed 2 months ago

vladigubler commented 3 months ago

Target SharePoint environment

SharePoint Online

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

πŸ’₯ SharePoint Framework

Developer environment

Windows

What browser(s) / client(s) have you tested

Additional environment details

Describe the bug / error

SPFX extension adds a command bar button to the list. In the new list view experience (MS Lists), the buttons show up in Edge/Chrome and execute. But when attempting to retrieve access tokens from AADTokenProvider in the button click event handler, it stops at some point with the MS scripts and doesn't actually returns anything. Buttons that do not use AADTokenProvider work normally.

BTW, the buttons do not load in FireFox at all.

Steps to reproduce

  1. Create an SPFx extension that adds command bar buttons to the list. Register API Access for some resource and approve.
  2. In the button click event use AADTokenProvider to retrieve an access token
  3. While in the new MS Lists interface, debug the code in F12 when executing and see that it never returns an access token while triggering no error.
  4. Compare to how the code executes in regular modern list view, where it successfully returns an access token.

Expected behavior

AADTokenProvider will return a valid access token as requested.

vladigubler commented 2 months ago

Seems to be ok now!