I am having trouble getting TFA working on a new site -- Drupal 9.4.

My key's in place, I have email enabled, as well as trusted browser, etc. But when I go to login, after I enter the username and password, I am just returned back to the login page. The mail with the code gets sent -- I just have nowhere to enter that code.

I have another site, in the same multi-site, where it is working as expected. I enter my username and password, and it takes me to a page to enter my code. I did set the other one up a while back, but I can't find any significant differences between the two setups (the one minor thing is that the order to plugins is different on the settings page).

Feel like there must be something simple I am missing, a companion module I haven't installed, but I have yet to find it.

Permissions are set up the same on the two sites. I don't see any related errors logged.


  • The code seems to be firing through TFA.
  • It looks like it gets to the right route tfa/{userid}/{hash}
  • The formstate redirect seems to be set correctly
  • but it ends back on user/login

1 Answer 1


The problem here was that I had a module with a hook_user_login_form_submit redirecting the user to /user which was overwriting the redirectURL of the submit form.

The good news is that I understand forms a bit better! It was pretty difficult to know that the redirect was being overridden... and I didn't know enough to look for it until I'd understood how the form worked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.