🐛[BUG] Login doesn't work properly if /api/currentUser route is protected
See original GitHub issue🐛 Bug description
I protected route /api/currentUser. Its redirecting to Login page if its is not authenticated. This is a right behaviour but the problem is once after entering correct credential still its redirecting to the Login page. If you try to login twice it works.
📷 Recurring step
1.Protect /api/currentUser route
🏞 Desired result
Login should happen after entering proper credenctial.
💻 Complex modern code
Feels like following flags are not working properly… After login, loading flag shows as false always…
/…/src/layouts/SecurityLayout.tsx
if ((!isLogin && loading) || !isReady) {
return <PageLoading />;
}
if (!isLogin) {
return <Redirect to={/user/login?${queryString}
}></Redirect>;
}
© Version Information
- Ant Design Pro 4.0.0
- linux
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:14
Top Results From Across the Web
Angular redirect to login page - authentication - Stack Overflow
I have a follow up Q, isn't if setting an arbitrary value to currentUser in the localStorage would still be able to access...
Read more >Troubleshoot backend health issues in Application Gateway
Solution: If you receive this error message, there's a mismatch between the certificate that has been uploaded to Application Gateway and the ...
Read more >Handling User Authentication With Angular and Flask
First, try logging in with the user credentials used to register earlier - e.g, test@test.com and test . If all went well, you...
Read more >Django Tutorial Part 8: User authentication and permissions
For example, throttling of login attempts and authentication against third ... Django will show an error that it could not find this URL, ......
Read more >Chapter 8: Log in, log out | Ruby on Rails Tutorial (3rd Ed.)
As seen in Figure 8.2, when the login information is invalid we want to re-render the login page and display an error message....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Same Issue I am facing. Without making any changes to the code , Even new bootstrap code itself having the same issue.
I can also confirm that I’ve been hit by this. It’s much simpler to reproduce also, if one follows the instructions here https://pro.ant.design/docs/getting-started and without making any modifications, login to the
/welcome
page only works if credentials are entered twice.The
connect
function inSecurityLayout.tsx
is called twice with very different payloads, which is where I believe the problem lies, first time with parameters that seem to be coming from routing and the second time with parameters coming from theuser
state.