Fixup login to be more reliable.
Legacy support fixup.
Legacy support fixup.
Improved handling of per-user tokens.
Starting support for API.