Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite loop on MS popup login #92

Open
urdaneta88 opened this issue Dec 28, 2021 · 2 comments
Open

Infinite loop on MS popup login #92

urdaneta88 opened this issue Dec 28, 2021 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@urdaneta88
Copy link

When i try to login the popup from MS start looping and the page make an infinity number of request to openid-configuration.

Here is the button with a child component just to have a custom style and icon

  <MicrosoftLogin
    useLocalStorageCache={false}
    clientId={MICROSOFT_OAUTH_CLIENT_ID}
    authCallback={authHandler}
    buttonTheme="light_short"
    debug={true}
  >
    <LoginIconButton
      text={i18nMicrosoft}
      iconUrl={iconMicrosoft}
    />
  </MicrosoftLogin>

This is the callBack

const authHandler = (error, data: { accessToken: string }) => {
  if (error.errorCode && error.errorCode === 'user_cancelled') {
    handlePopupClosing();
  } else {
    handleResponseMicrosoft(error, data);
  }
};

Ifi the user close the popup we handle that like this (we are using redux and the Store.dispatch is needed to call any action)

export const handlePopupClosing = () => {
  Store.dispatch(clearLoginErrors());
  Store.dispatch(setLoginPopupClosedByUserGoogleMicrosoft(true));
  Store.dispatch(toggleLoadingGoogleMicrosoft(false));
};

Otherwise we call this function and make a request to our server with the token and confirm that the user is in our DB

export const handleResponseMicrosoft = (err, data: { accessToken: string }) => {
  Store.dispatch(toggleLoadingGoogleMicrosoft(true));
  if (!err) {
    // If err is falsy we make the resquest to the server
    // and if the response is OK we set the required states to give the user access to the page
  } else {
    handleFailure(err);
  }
};

Video evidence of the bug
Infinity requests

2021-12-28.13-53-44_infinity_resquests.mp4

Infinity popup

2021-12-28.13-44-34_popup_loop.mp4

dependencies

"react": "^16.12.0",
"react-app-polyfill": "0.2.2",
"react-dates": "^21.8.0",
"react-dom": "^16.12.0",
"react-google-login": "^5.2.2",
"react-i18next": "^11.11.0",
"react-microsoft-login": "^1.15.0",
"react-redux": "7.1.0",
"react-router-dom": "5.0.1",
"react-scripts": "^3.4.0",
"react-use": "^13.27.0",
"react-virtuoso": "^0.13.2",
"react-with-direction": "^1.3.1",
"redux": "4.0.4",
"redux-devtools-extension": "2.13.8",
"redux-thunk": "2.3.0",
"reselect": "^4.0.0",
"styled-components": "^4.0.0",
"typeface-asap": "0.0.69",
"wade": "^0.3.3"
@urdaneta88 urdaneta88 added the bug Something isn't working label Dec 28, 2021
@urdaneta88 urdaneta88 changed the title Infinity loop on MS popup login Infinite loop on MS popup login Dec 28, 2021
@parthsavaliya1
Copy link

Hii same issue replicate for me in version 1.15.0. any update on this?

@klendi
Copy link

klendi commented Sep 9, 2022

Any updates on this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants