1 """Config flow for Electric Kiwi."""
3 from __future__
import annotations
5 from collections.abc
import Mapping
12 from .const
import DOMAIN, SCOPE_VALUES
16 config_entry_oauth2_flow.AbstractOAuth2FlowHandler, domain=DOMAIN
18 """Config flow to handle Electric Kiwi OAuth2 authentication."""
25 return logging.getLogger(__name__)
29 """Extra data that needs to be appended to the authorize url."""
30 return {
"scope": SCOPE_VALUES}
33 self, entry_data: Mapping[str, Any]
34 ) -> ConfigFlowResult:
35 """Perform reauth upon an API authentication error."""
39 self, user_input: dict[str, Any] |
None =
None
40 ) -> ConfigFlowResult:
41 """Dialog that informs the user that reauth is required."""
42 if user_input
is None:
43 return self.async_show_form(step_id=
"reauth_confirm")
44 return await self.async_step_user()
47 """Create an entry for Electric Kiwi."""
48 existing_entry = await self.async_set_unique_id(DOMAIN)
50 return self.async_update_reload_and_abort(existing_entry, data=data)
dict[str, Any] extra_authorize_data(self)
ConfigFlowResult async_step_reauth_confirm(self, dict[str, Any]|None user_input=None)
logging.Logger logger(self)
ConfigFlowResult async_oauth_create_entry(self, dict data)
ConfigFlowResult async_step_reauth(self, Mapping[str, Any] entry_data)