How to authorize user with email/password from server code?

Thank you, @jmangelo, that got me over the hump. With a little more struggling with poor docs and error messages I have managed to get registration and login working. I hope that password reset will be simple!