diff --git a/custom_components/alexa_media/config_flow.py b/custom_components/alexa_media/config_flow.py index b5289969..2a6a47cb 100644 --- a/custom_components/alexa_media/config_flow.py +++ b/custom_components/alexa_media/config_flow.py @@ -501,7 +501,11 @@ async def _test_login(self): step_id="verificationcode", data_schema=vol.Schema(self.verificationcode_schema), ) - if login.status and login.status.get("force_get"): + if ( + login.status + and login.status.get("force_get") + and not login.status.get("ap_error_href") + ): _LOGGER.debug("Creating config_flow to wait for user action") self.automatic_steps = 0 return self.async_show_form( @@ -513,13 +517,15 @@ async def _test_login(self): "message": f" \n>{login.status.get('message','')} \n", }, ) - if login.status and login.status.get("login_failed"): + if login.status and ( + login.status.get("login_failed") or login.status.get("ap_error_href") + ): _LOGGER.debug("Login failed: %s", login.status.get("login_failed")) await login.close() self.hass.components.persistent_notification.async_dismiss( "alexa_media_relogin_required" ) - return self.async_abort(reason=login.status.get("login_failed"),) + return self.async_abort(reason=login.status.get("login_failed")) new_schema = self._update_schema_defaults() if login.status and login.status.get("error_message"): _LOGGER.debug("Login error detected: %s", login.status.get("error_message"))