Moved the try/catch to include the login call so that exceptions authorizing are logged out to the server and not silenced.

Issue: MIRTH-1960