Log in a user via the API

Hmm that is ugly, but may be necessary. I hope there could be a different way.