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

loginPage={false} ends up calling logout and checkAuth in an infinite loop after logout #8685

Closed
slax57 opened this issue Feb 27, 2023 · 1 comment · Fixed by #9166
Closed
Assignees

Comments

@slax57
Copy link
Contributor

slax57 commented Feb 27, 2023

What you were expecting:
Being able to pass loginPage={false} to <Admin> without breaking the App.

What happened instead:
After I logout, I get redirected to /login, which ends up in an infinite loop calling logout and checkAuth because the route no longer exists.

Steps to reproduce:

  1. Go to https://stackblitz.com/edit/github-hwp9xd?file=src/index.tsx
  2. Open the user menu in the AppBar and click on the 'Logout' button
  3. Notice that in the DevTools console, called logout! and called checkAuth! appear in loop

Related code:
https://stackblitz.com/edit/github-hwp9xd?file=src/index.tsx

Environment

  • React-admin version: 4.8.1
  • Last version that did not exhibit the issue (if applicable): unknown
  • React version: 18
  • Browser: Chrome
  • Stack trace (in case of a JS error):
@djhi
Copy link
Contributor

djhi commented Feb 28, 2023

I think this is expected. If you disabled the login page we have no other option than to redirect on the home page and that will call the checkAuth function indeed. It's your responsability to redirect to a custom unprotected route or an external service (auth0, etc).

I believe this is a documentation issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants