Add login support. Fixes #3