Cleans up authentication flow and authentication checking in app.