raise UnauthorizedError upon invalid credentials