Auto logging users in when they register

I have been trying to make this work for a while and finally came up with these server action steps to register and auto login users:

  1. Database connection
  2. Database insert: register_user (insert options: $_POST.username & $_POST.password.passwordHash… etc)
  3. Security Provider
  4. Security Login ($_POST.username & $_POST.password)

Passwords are hashed with Argon2id and all happens in one server action file, so it must be secure, right? Advantage of this method is that the repeat and get_registered_user steps can be left out, besides that this setup works for me and I couldn’t get the one from the tutorial working :grimacing:

Any comments?