Log in a user via the API

@wasimkham we are trying to do exactly similiar thing; and I am just wondering what final approach did you choose?