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
- Call a dialog pop up in Word web add-in then in that popup use the loginRedirect promise function.
- Works great! I authenticate using my APPid and tenant ID.
- One observation is it requires a HTTPS reply redirect URL!!!!
- However when it returns after successful login I get few errors in my dev tool console
- First it cannot find an html element and it returns null or undefined
- Second I saw a Unable to get property 'then' of undefined or null reference when I clicked signIn() and ran the loginRedirect function
- 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'); ?
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!