Sets up login and logout flow.