From d02fc56a60634699d7b5f43f95463013c73244d9 Mon Sep 17 00:00:00 2001 From: Madhav Ramlugun Date: Sat, 6 Jan 2024 09:50:05 +0400 Subject: [PATCH] Fix an issue with Microsoft where the user had to click on login a second time for his login to register with the app. This was caused by a too early removal of the storage event listener' --- src/LoginSocialMicrosoft/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/LoginSocialMicrosoft/index.tsx b/src/LoginSocialMicrosoft/index.tsx index ab34b77..28888d0 100644 --- a/src/LoginSocialMicrosoft/index.tsx +++ b/src/LoginSocialMicrosoft/index.tsx @@ -137,9 +137,9 @@ export const LoginSocialMicrosoft = ({ ); const onChangeLocalStorage = useCallback(() => { - window.removeEventListener('storage', onChangeLocalStorage, false); const code = localStorage.getItem('microsoft'); if (code) { + window.removeEventListener('storage', onChangeLocalStorage, false); handlePostMessage({ provider: 'microsoft', type: 'code', code }); localStorage.removeItem('microsoft'); }