Switch to  scope on login/logout. Fixes #1104