Home Assistant Unofficial Reference 2024.12.1
application_credentials.py
Go to the documentation of this file.
1 """application_credentials platform the Electric Kiwi integration."""
2 
4  AuthorizationServer,
5  ClientCredential,
6 )
7 from homeassistant.core import HomeAssistant
8 from homeassistant.helpers import config_entry_oauth2_flow
9 
10 from .const import OAUTH2_AUTHORIZE, OAUTH2_TOKEN
11 from .oauth2 import ElectricKiwiLocalOAuth2Implementation
12 
13 
15  hass: HomeAssistant, auth_domain: str, credential: ClientCredential
16 ) -> config_entry_oauth2_flow.AbstractOAuth2Implementation:
17  """Return auth implementation."""
19  hass,
20  auth_domain,
21  credential,
22  authorization_server=await async_get_authorization_server(hass),
23  )
24 
25 
26 async def async_get_authorization_server(hass: HomeAssistant) -> AuthorizationServer:
27  """Return authorization server."""
28  return AuthorizationServer(
29  authorize_url=OAUTH2_AUTHORIZE,
30  token_url=OAUTH2_TOKEN,
31  )
32 
33 
34 async def async_get_description_placeholders(hass: HomeAssistant) -> dict[str, str]:
35  """Return description placeholders for the credentials dialog."""
36  return {
37  "more_info_url": "https://www.home-assistant.io/integrations/electric_kiwi/"
38  }
config_entry_oauth2_flow.AbstractOAuth2Implementation async_get_auth_implementation(HomeAssistant hass, str auth_domain, ClientCredential credential)
AuthorizationServer async_get_authorization_server(HomeAssistant hass)