My question is based on this question: Programmatically User login not working i dont have this clear, to login an user (create an active session) only need use User::Load()? i'm triying make this on my custom module, due to i need an independent login and register form, but dont work. Someone can help me? i want create a user session and let the user navigate for all sections that your role have assigned, but without pass by "user/login" route. Thanks in advance. On resume i want emulate the login controller shipped with drupal 8.
User::load() loads information about an account, it does not inject or alter the current session in any way.
user_login_finalize() is one of the key functions when doing programatic user logins because it will create and set a session for the current user.