OfficeDev / generator-office

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

My SSO Office Add-In quick start error: There are no active accounts. #682

Closed o8w closed 2 years ago

o8w commented 2 years ago

TL;DR

I'm doing the "Use the Yeoman generator to create an Office Add-in that uses single sign-on" quick start and I hit a problem at "Configure SSO" as follows:

ERROR: There are no active accounts.

The Azure browser login seemed to work fine with redirect to Azure documentation. I don't have 2FA setup with that free account, so wasn't expecting a problem with configure-sso.

Instead I tried following manual steps to set up the app registration and hit a different error when trying to start the server:

Failed to start SSO server. Error: Credential store does not have secret for 'My Office Add-in SSO'

I'm not familiar with Azure and AAD, but I speculate the free personal account I'm using to log into Azure Active Directory admin center does not have admin rights and this could have caused problems with the app registration. I wasn't able to find any UI for step 19 "On the same page, choose the Grant admin consent for [tenant name] button, and then select Yes for the confirmation that appears." And generally when I click around areas like Azure AD Roles and Administrators, I get "No access". If true how would I fix this?

Instruction step 2 for the manual app registration says "Sign in with the admin credentials to your Microsoft 365 tenancy. For example, MyName@contoso.onmicrosoft.com." What subdomain to use for a free personal account?

I'm using the same free personal account to test add-ins and configure app registrations. Should that be ok?

Previously I did the React Graph Tutorial which also involved setting up an app registration. That all worked fine, but I'm wondering if this is somehow causing a problem for the SSO add-in?

I saw some comments in other issues about adding entries to .env and some code to server.js, but there is no such file in the Yeoman project so I don't know where to start with this.

Details

Error with configure-sso

npm run configure-sso

office-addin-taskpane-sso-js@0.0.0 configure-sso office-addin-sso configure manifest.xml

Opening browser for authentication to Azure. Enter valid Azure credentials node:internal/process/promises:246 triggerUncaughtException(err, true / fromPromise /); ^

[UnhandledPromiseRejection: 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(). The promise rejected with the reason "ERROR: There are no active accounts. ".] { code: 'ERR_UNHANDLED_REJECTION' }

Error running npm start after manually configuring app registration following linked instructions

npm start

office-addin-taskpane-sso-js@0.0.0 start npm run build:dev && concurrently "npm run start:server" "npm run sideload"

office-addin-taskpane-sso-js@0.0.0 build:dev webpack --mode development

Browserslist: caniuse-lite is outdated. Please run: npx browserslist@latest --update-db

Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating assets by status 1.7 KiB [cached] 1 asset assets by path assets/.png 26.9 KiB 6 assets assets by path .js 1.57 MiB asset polyfill.js 643 KiB [compared for emit] (name: polyfill) 1 related asset asset taskpane.js 577 KiB [compared for emit] (name: taskpane) 1 related asset asset fallbackauthdialog.js 381 KiB [compared for emit] (name: fallbackauthdialog) 1 related asset asset commands.js 3.3 KiB [compared for emit] (name: commands) 1 related asset assets by path .html 5.13 KiB asset taskpane.html 3.86 KiB [compared for emit] asset fallbackauthdialog.html 813 bytes [compared for emit] asset commands.html 485 bytes [compared for emit] asset manifest.dev.xml 4.39 KiB [compared for emit] [from: manifest.xml] [copied] runtime modules 2.81 KiB 13 modules modules by path ./node_modules/core-js/ 386 KiB 381 modules modules by path ./node_modules/msal/lib-es6/ 290 KiB 42 modules modules by path ./node_modules/stream-http/ 114 KiB 20 modules modules by path ./src/ 14.9 KiB modules by path ./src/helpers/.js 13.4 KiB 4 modules 2 modules modules by path ./node_modules/office-addin-sso/lib/.js 9.49 KiB 5 modules modules by path ./node_modules/url/ 37.4 KiB 3 modules modules by path ./node_modules/querystring/.js 4.51 KiB ./node_modules/querystring/index.js 127 bytes [built] [code generated] ./node_modules/querystring/decode.js 2.34 KiB [built] [code generated] ./node_modules/querystring/encode.js 2.04 KiB [built] [code generated] 15 modules webpack 5.53.0 compiled successfully in 6903 ms [1] [1] > office-addin-taskpane-sso-js@0.0.0 sideload [1] > office-addin-debugging start manifest.xml [1] [0] [0] > office-addin-taskpane-sso-js@0.0.0 start:server [0] > office-addin-sso start manifest.xml [0] [1] Debugging is being started... [1] App type: desktop [0] Failed to start SSO server. Error: Credential store does not have secret for 'My Office Add-in SSO'. [0] node:internal/process/promises:246 [0] triggerUncaughtException(err, true / fromPromise /); [0] ^ [0] [0] [UnhandledPromiseRejection: 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(). The promise rejected with the reason "false".] { [0] code: 'ERR_UNHANDLED_REJECTION' [0] } [0] npm run start:server exited with code 1 [1] ? Allow localhost loopback for Microsoft Edge WebView? (Y/n)

millerds commented 2 years ago

I don't believe the person azure account is part of a tenant using SSO. The easiest way to try this out is with a dev tenant and the account connected to that. It's also free . . . see https://developer.microsoft.com/en-us/microsoft-365/dev-program