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

Protecting a route with 2 login steps (i.e. login and 2FA) fails to redirect #221

Open
eladbs opened this issue Jan 9, 2018 · 0 comments

Comments

@eladbs
Copy link

eladbs commented Jan 9, 2018

Hi,
I'm trying to implement a 2 step log in (normal user/pass login and a 2FA login).
My route setup is something like this:

    <Route path="/" component={App}>
      <IndexRedirect to="VeryProtectedRoute"/>
      <Route path="login" component={userIsNotAuthenticated(Login)}/>
      <Route path="2FALogin" component={userIsAuthenticated(userIsNot2FAAuthenticated(2FALogin))}/>
      <Route path="VeryProtectedRoute" component={userIsAuthenticated(userIs2FAAuthenticated(VeryProtectedComponent))}/>
    </Route>

The process is like this:

  1. I try to go to /VeryProtectedRoute.
  2. I get redirected to /login?redirect=%2FVeryProtectedRoute.
  3. I login successfully.
  4. I get redirected to /VeryProtectedRoute.
  5. I get redirected to /2FALogin.
  6. I 2fa login successfully.
  7. I stay in /2FALogin and I am NOT redirected to /VeryProtectedRoute.

The problem is in step 5 - The URL i'm being redirected to lacks the "redirect" query param like in step 2. It should redirect me to "/2FALogin?redirect=%2FVeryProtectedRoute"....

Any clues on where to start look for a solution or the error in not adding the redirect?

Currently, we manually add the "redirect" query param but we'd like to have a general working code...
Thanks in advance!

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

No branches or pull requests

1 participant