microsoft-graph-toolkit
microsoft-graph-toolkit copied to clipboard
[BUG] Unhandled Promise rejection in MSal2Provider, when user cancels login flow in Popup
Describe the bug Unhandled Promise rejection for initProvider in mgt-msal2-provider, when user cancels login flow in Popup
core.mjs:10614 ERROR Error: Uncaught (in promise): BrowserAuthError: user_cancelled: User cancelled the flow. BrowserAuthError: user_cancelled: User cancelled the flow. at BrowserAuthError.AuthError [as constructor] (AuthError.js:31:24) at new BrowserAuthError (BrowserAuthError.js:201:28) at BrowserAuthError.createUserCancelledError (BrowserAuthError.js:290:16) at PopupClient.js:295:45 at timer (zone.umd.js:2441:47) at _ZoneDelegate.invokeTask (zone.umd.js:445:35) at core.mjs:10757:55 at AsyncStackTaggingZoneSpec.onInvokeTask (core.mjs:10757:36) at _ZoneDelegate.invokeTask (zone.umd.js:444:64) at Object.onInvokeTask (core.mjs:11070:33) at resolvePromise (zone.umd.js:1250:35) at zone.umd.js:1157:21 at zone.umd.js:1173:37 at rejected (Msal2Provider.js:11:89) at _ZoneDelegate.invoke (zone.umd.js:411:30) at Object.onInvoke (core.mjs:11083:33) at _ZoneDelegate.invoke (zone.umd.js:410:56) at Zone.run (zone.umd.js:165:47) at zone.umd.js:1314:38 at _ZoneDelegate.invokeTask (zone.umd.js:445:35)
To Reproduce Steps to reproduce the behavior:
- Create a new instance of MSal2Provider with clientId ,redirectUri, loginType: LoginType.Popup and the approrpiate scopes
- When provider gets initialised with a popup close the popup
- See error in console
Expected behavior The promise rejection should be handled
Screenshots
Environment (please complete the following information):
- OS: Windows
- Browser : Chrome
- Framework: Angular v16
- Context: Web
- Version "@microsoft/mgt-element": "^2.10.0", "@microsoft/mgt-msal2-provider": "^2.10.0", "@microsoft/microsoft-graph-types": "^2.26.0",
- Provider: Msal2Provider
As we released v4 a couple weeks ago, can you try with using MGT v4 and see if you get the same error? Thanks!
Same error here, the loginFailed function does not catch the close popup event. I am using: @microsoft/mgt-react:4.2.1 @microsoft/mgt-element: 4.2.1 @microsoft/mgt-msal2-provider:4.2.1
Hi @sokratisvs. Any update with this bug?