Search code examples
microsoft-graph-toolkit

Mgt-Login not firing a loginCompleted event


I've got an mgt-login component working fine in a page, but I can't seem to get the loginCompleted event to fire, using the following:

        document.querySelector('mgt-login').addEventListener('loginCompleted', e => {
            console.log(e);
        });

The "addEventListener" line is getting hit, but I can't seem to get it to do the console.log, nor is a breakpoint hit. I'm sure I'm missing something obvious, but some help would be greatly appreciated.


Solution

  • I don't see anything wrong with your syntax, rather it seems like this event isn't working property. The Provider state upon login initialization is returning signedOut and results in the following event:

    this.fireCustomEvent('loginFailed');

    instead. If you can please create an issue on the repository with the bug details, we'll handle this within the next possible release.