Replies: 1 comment 5 replies
-
Hey @ariep Some tips that might help: A. The account recovery flow in Kratos involves sending a link or a one-time code to the recovery address defined by the user. The user must access the link or enter the code they received to confirm their identity and ownership of the account. When the user accesses the configured recovery method, they receive a privileged session and are taken to their account's settings page where they must create a new password to regain access to their account. The account recovery flow doesn't reset user's second authentication factor. source |
Beta Was this translation helpful? Give feedback.
-
Hi, we've been using Kratos (and Hydra) for quite some time in our project, thanks a lot for it!
Recently we've been implementing 2FA, but now I've hit a redirect loop. I can reproduce it -- with my own app -- as follows:
What happens then:
/kratos/self-service/recovery/browser
.to_session
to lookup the session based on the cookie.to_session
, saying that the aal is not high enough and suggesting we redirect to/kratos/self-service/login/browser?aal=aal2
./kratos/self-service/login/browser
.flow=
parameter for some reason.flow
parameter, is in the same situation as in 5. and the loop is complete. We get redirected back and forth between kratos and our login page.[*] To explain why we don't follow kratos' suggestion of redirecting: note that this is the app's login page. We arrive at the same code path if you do a regular login, first entering email&password, and then your 2FA. If we do pass on the redirect suggested by kratos -- I tried that -- you'll get in a redirect loop in this regular login process. I don't yet see something that would allow us to make the distinction at that point in the code between the recovery context and regular login -- it's just the login page, which doesn't know about the recovery that prompted it.
So my question is: how to fix this :). More specifically and maybe more helpfully:
A. At step 1. above, is it expected that when starting the recovery flow, Kratos redirects to the login page? I guess that's because we require 2FA for recovery (by setting
kratos.config.selfservice.flows.settings.aal_required: highest_available
), but somehow I did not see that coming. I guess I had expected the 2FA to be part of the recovery flow, instead of a whole login flow as I seem to get now.B. Is it reasonable to ignore the redirect suggested by Kratos at 5.? If not, how should I prevent the redirect loop for the regular login mentioned in [*]?
C. Why would Kratos not include the
flow
parameter at 6.? I'm not even sure if the recovery would complete successfully if it did, but the failure to include theflow
seems the immediate cause for the redirect loop.Sorry for the long text, thanks for any advice!
Beta Was this translation helpful? Give feedback.
All reactions