implements client authentication error handling, fixes #34