throw exception if credentials are invalid