OfficeDev / generator-office

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

The configure-sso script fails on Mac (works on Windows) #509

Closed jasjitsm closed 4 years ago

jasjitsm commented 4 years ago

Here's the Yeoman configuration I'm using when creating the add-in project.

? Choose a project type: Office Add-in Task Pane project supporting single sign-on
? Choose a script type: Javascript
? What do you want to name your add-in? brand-images
? Which Office client application would you like to support? PowerPoint

The add-in is created without any errors. I then cd into the add-in project directory and run the configure-sso script, which produces the following:

> office-addin-taskpane-sso@0.0.0 configure-sso /Users/jmarwah/Documents/Habanero/brand-images
> office-addin-sso configure manifest.xml

Opening browser for authentication to Azure. Enter valid Azure credentials
Login was successful!
Registering new application in Azure
Application was successfully registered with Azure
Setting identifierUri
Setting signin audience
Checking if logged-in user is a tenant admin
Granting admin consent
Setting SharePoint reply urls for tenant
/bin/sh: -c: line 0: unexpected EOF while looking for matching `"'
/bin/sh: -c: line 1: syntax error: unexpected end of file

(node:96123) UnhandledPromiseRejectionWarning: Error: Unable to register new application brand-images.
Error: Unable to set tenant reply urls for brand-images.
/bin/sh: -c: line 0: unexpected EOF while looking for matching `"'
/bin/sh: -c: line 1: syntax error: unexpected end of file

    at /Users/jmarwah/Documents/Habanero/brand-images/node_modules/office-addin-sso/lib/configure.js:87:19
    at Generator.throw (<anonymous>)
    at rejected (/Users/jmarwah/Documents/Habanero/brand-images/node_modules/office-addin-sso/lib/configure.js:4:65)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:96123) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:96123) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

The application is actually successfully registered in AAD, but the script seems to fail when setting the application secret. Any attempts to start the local server result in failure when getting the application secret as well:

> office-addin-taskpane-sso@0.0.0 start:server /Users/jmarwah/Documents/Habanero/brand-images
> office-addin-sso start manifest.xml

Getting application secret for brand-images from Mac OS Keychain
(node:96688) UnhandledPromiseRejectionWarning: false
(node:96688) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:96688) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Testing on 2 different Macs (Catalina) with: Node: v10.16.2 and 12.4.1 Yeoman: v3.1.1 generator-office: v1.5.0

Works fine on a Windows 10 VM with the same package versions.

TCourtneyOwen commented 4 years ago

@jasjitsm Thanks for the detailed report. My guess is that the script never even got to the point where it added the secret to the keychain because it failed on the step when setting the SharePoint reply Url. Let me look it no and get back to you shortly

-Courtney

TCourtneyOwen commented 4 years ago

@jasjitsm I am hitting this as well and this must be due to a very recent change. I should be able to fix it pretty quickly. I will let you know when the fix is available.

Thanks!

TCourtneyOwen commented 4 years ago

OK got the fix for Mac - just need to validate it will also work on Windows.

jasjitsm commented 4 years ago

@TCourtneyOwen It works great now! Thanks for the super quick replies and resolution!

TCourtneyOwen commented 4 years ago

Awesome glad to hear it!!!