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'); }