Add error management in authentication factory for invalid credentials