syncweek-react-aad / react-aad

A React wrapper for Azure AD using the Microsoft Authentication Library (MSAL). The easiest way to integrate AzureAD with your React for authentication.
MIT License
344 stars 94 forks source link

AAD_LOGIN_SUCCESS event is triggered twice on login #256

Open nairmanu opened 4 years ago

nairmanu commented 4 years ago

Library versions

Describe the bug On login, react-aad-msal library sends AAD_LOGIN_SUCCESS event twice in certain situations. This is not specific to login success event. I see multiple events for AAD_ACQUIRED_ID_TOKEN_SUCCESS as well.

I noticed there is a missing await keyword for processLogin() which may or may not be contributing to the issue? https://github.com/syncweek-react-aad/react-aad/blob/a7205ef20c6f9dafff94afbe276fa8fba46b9ef0/packages/react-aad-msal/src/MsalAuthProvider.ts#L314

Expected behavior AAD_LOGIN_SUCCESS should be triggered only once

Desktop (please complete the following information):

d3vAdv3ntur3s commented 4 years ago

Experiencing the same @nairmanu

roxkisrover commented 4 years ago

Got same behaviour with LoginType.Redirect scenario: image

sanchopancho13 commented 3 years ago

We get the same event sequence reported by @roxkisrover.