Home Assistant Unofficial Reference 2024.12.1
application_credentials.py
Go to the documentation of this file.
1 """application_credentials platform for nest."""
2 
3 import oauth2client
4 
6  AuthorizationServer,
7  ClientCredential,
8 )
9 from homeassistant.core import HomeAssistant
10 from homeassistant.helpers import config_entry_oauth2_flow
11 
12 from .api import GoogleHybridAuth
13 
14 AUTHORIZATION_SERVER = AuthorizationServer(
15  oauth2client.GOOGLE_AUTH_URI, oauth2client.GOOGLE_TOKEN_URI
16 )
17 
18 
20  hass: HomeAssistant, auth_domain: str, credential: ClientCredential
21 ) -> config_entry_oauth2_flow.AbstractOAuth2Implementation:
22  """Return auth implementation."""
23  return GoogleHybridAuth(hass, auth_domain, credential, AUTHORIZATION_SERVER)
24 
25 
26 async def async_get_description_placeholders(hass: HomeAssistant) -> dict[str, str]:
27  """Return description placeholders for the credentials dialog."""
28  return {
29  "oauth_consent_url": (
30  "https://console.cloud.google.com/apis/credentials/consent"
31  ),
32  "more_info_url": "https://www.home-assistant.io/integrations/google/",
33  "oauth_creds_url": "https://console.cloud.google.com/apis/credentials",
34  }
config_entry_oauth2_flow.AbstractOAuth2Implementation async_get_auth_implementation(HomeAssistant hass, str auth_domain, ClientCredential credential)
dict[str, str] async_get_description_placeholders(HomeAssistant hass)