Add support for logging in using the API, and saving authuser locally.