Hello.js MSAL usage in Office Web Add-in Issue

286 views Asked by At

I'm using the hello.js for MSAL Microsoft Active Directory Library to authenticate a user for a Word Office web add-in. It works great up to returning to my original window.

Here's my basic setup

  1. Call a dialog pop up in Word web add-in then in that popup use the loginRedirect promise function.
  2. Works great! I authenticate using my APPid and tenant ID.
  3. One observation is it requires a HTTPS reply redirect URL!!!!
  4. However when it returns after successful login I get few errors in my dev tool console
  5. First it cannot find an html element and it returns null or undefined
  6. Second I saw a Unable to get property 'then' of undefined or null reference when I clicked signIn() and ran the loginRedirect function
  7. This hello.js library is from the https://github.com/AzureAD/microsoft-authentication-library-for-js

Please let me know why I'm getting null or undefined when using var divWelcome = document.getElementById('WelcomeMessage'); ?

1

There are 1 answers

0
Tom On

I solved this by restructuring my code and isolating the issue. There was an error that was preventing full processing. The MSAL Hello.js library works very well even for Office Add-ins!