Dear Andrus Shirnavana
Thank you for posting your question on the Q&A forum.
Based on the details you shared, here are some suggestions based on my research:
1> Match Domains Exactly: If you’re running on https://localhost:3000 but your code loads or redirects to https://localhost:3000/login.html (or another port/subdomain), Office may treat it as untrusted unless the exact domain is listed in the <AppDomains> section of your manifest.xml. Please ensure all development domains are included there.
2> Trust Your Development Certificate: If you’re using a self-signed certificate for localhost that isn’t in the Windows Trusted Root Certification Authorities store, Office will block the page.
- If your add-in was scaffolded with Yeoman (
yo office), run: npx office-addin-dev-certs install (or --machine for system-wide trust). Approve the prompt to add the cert to the trusted store.
- If not using Yeoman, you can manually create and trust a cert via PowerShell:
New-SelfSignedCertificate -DnsName "localhost" -CertStoreLocation "cert:\CurrentUser\My" Export the cert and import it into Trusted Root Certification Authorities using certmgr.msc. Update your dev server to use this cert, then restart Excel.
- Verify by opening
https://localhost:<port> in Edge or Chrome, if no warning appears, the cert is trusted.
3> Switch to WebView2: If you want to use the modern runtime:
- Install the WebView2 Evergreen Runtime from Microsoft Edge WebView2.
- Set the registry key:
HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Wef\Developer
UseWebView2 (DWORD) = 1
4> Catch and Log Errors: Consider wrapping calls like OfficeRuntime.auth.getAccessToken({ allowConsentPrompt: true }) with error handling and logging for better diagnostics.
References:
Office Add-ins manifest
Sideload Office Add-ins for testing from a network share - Office Add-ins | Microsoft Learn
Microsoft Edge WebView2 and Microsoft 365 Apps
Hope this helps!
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.