Refactor email/password auth to allow use with tool shed API as well.