microsoftgraph / microsoft-graph-toolkit

Authentication Providers and UI components for Microsoft Graph 🦒
https://docs.microsoft.com/graph/toolkit/overview
Other
923 stars 286 forks source link

[BUG] Unhandled Promise rejection in MSal2Provider, when user cancels login flow in Popup #3070

Open sokratisvs opened 4 months ago

sokratisvs commented 4 months ago

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:

  1. Create a new instance of MSal2Provider with clientId ,redirectUri, loginType: LoginType.Popup and the approrpiate scopes
  2. When provider gets initialised with a popup close the popup
  3. See error in console

Expected behavior The promise rejection should be handled

Screenshots image

Environment (please complete the following information):

sebastienlevert commented 4 months ago

As we released v4 a couple weeks ago, can you try with using MGT v4 and see if you get the same error? Thanks!

alequint8912 commented 2 months ago

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

image

alequint8912 commented 2 months ago

Hi @sokratisvs. Any update with this bug?