OfficeDev / generator-office

Yeoman generator for building Microsoft Office related projects.
https://www.npmjs.com/package/generator-office
MIT License
819 stars 207 forks source link

Redirect URI fallbackauthdialog.html needs to be set to SPA #735

Closed plagwitz closed 1 year ago

plagwitz commented 1 year ago

Prerequisites

Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.

Expected behavior

To start an SSO application from an MSAL-based version, I created an app, based on cloned yeoman 1.9.2 and the included script configure-sso.

SSO should check if I have a token from MS365. If not, SSO should present me with fallbackauthdialog.html to log in and retrieve such a token.

(This is how "Office-Add-in-samples\Samples\auth\Office-Add-in-NodeJS-SSO" worked).

Current behavior

Using the Azure app registration that configure-sso from 1.9.2 automated, running the app and pressing the taskpane button, what could be the dialog window frame briefly flashes, then closes.

And while debug output shows e.g. :

[0] GET /getuserdata?= (...) 200 846.436 ms - 715 [0] GET /getuserdata?=(...) 200 824.319 ms - 715

I also see: error: 'invalid_grant' error_codes: (1) [65001] error_description: 'AADSTS65001: The user or administrator has not consented to use the application with ID 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX' named 'XXXXXX'. Send an interactive authorization request for this user and resource.\r\nTrace ID: 4c8dbf7e-283a-4bac-b072-0feb88837600\r\nCorrelation ID: 8c765c6c-c1a8-4e6e-9bf5-ad3a160f8c11

But I do not get the dialog for interaction.

After adding, in Azure / App registration / Authentication / Single-Page Application for the generated application, "fallbackauthdialog.html" (and removing fallbackauthdialog.html from the "Web" section of that page), I get the expected behavior, i.e. data drop from MSGraph onto my sheet (actually without dialog flashing).

Steps to Reproduce

Clone, install and build yeoman 1.9.2. Generate an Excel-hosted SSO application, including Azure registration. Run script configure-sso. Update the GUID in the code to your application. Start the application. Sideload the add-in. Press the button in the task pane.

Context

Failure Logs