question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

🐛[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:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:14

github_iconTop GitHub Comments

4reactions
jinuemcommented, Nov 21, 2019

Same Issue I am facing. Without making any changes to the code , Even new bootstrap code itself having the same issue.

4reactions
nedosacommented, Nov 17, 2019

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 in SecurityLayout.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 the user state.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found