Added greater support for session tokens for login.  Added some extra logic for other cases during login.