Home Assistant Unofficial Reference 2024.12.1
homeassistant.helpers.config_entry_oauth2_flow Namespace Reference

Classes

class  AbstractOAuth2FlowHandler
 
class  AbstractOAuth2Implementation
 
class  LocalOAuth2Implementation
 
class  OAuth2AuthorizeCallbackView
 
class  OAuth2Session
 

Functions

dict[str, Any]|None _decode_jwt (HomeAssistant hass, str encoded)
 
str _encode_jwt (HomeAssistant hass, dict data)
 
None async_add_implementation_provider (HomeAssistant hass, str provider_domain, Callable[[HomeAssistant, str], Awaitable[list[AbstractOAuth2Implementation]]] async_provide_implementation)
 
AbstractOAuth2Implementation async_get_config_entry_implementation (HomeAssistant hass, config_entries.ConfigEntry config_entry)
 
dict[str, AbstractOAuth2Implementationasync_get_implementations (HomeAssistant hass, str domain)
 
client.ClientResponse async_oauth2_request (HomeAssistant hass, dict token, str method, str url, **Any kwargs)
 
None async_register_implementation (HomeAssistant hass, str domain, AbstractOAuth2Implementation implementation)
 

Variables

 _LOGGER = logging.getLogger(__name__)
 
string AUTH_CALLBACK_PATH = "/auth/external/callback"
 
int CLOCK_OUT_OF_SYNC_MAX_SEC = 20
 
string DATA_JWT_SECRET = "oauth2_jwt_secret"
 
string HEADER_FRONTEND_BASE = "HA-Frontend-Base"
 
string MY_AUTH_CALLBACK_PATH = "https://my.home-assistant.io/redirect/oauth"
 
int OAUTH_AUTHORIZE_URL_TIMEOUT_SEC = 30
 
int OAUTH_TOKEN_TIMEOUT_SEC = 30
 

Detailed Description

Config Flow using OAuth2.

This module exists of the following parts:
 - OAuth2 config flow which supports multiple OAuth2 implementations
 - OAuth2 implementation that works with local provided client ID/secret

Function Documentation

◆ _decode_jwt()

dict[str, Any] | None homeassistant.helpers.config_entry_oauth2_flow._decode_jwt ( HomeAssistant  hass,
str  encoded 
)
private
JWT encode data.

Definition at line 577 of file config_entry_oauth2_flow.py.

◆ _encode_jwt()

str homeassistant.helpers.config_entry_oauth2_flow._encode_jwt ( HomeAssistant  hass,
dict  data 
)
private
JWT encode data.

Definition at line 568 of file config_entry_oauth2_flow.py.

◆ async_add_implementation_provider()

None homeassistant.helpers.config_entry_oauth2_flow.async_add_implementation_provider ( HomeAssistant  hass,
str  provider_domain,
Callable[ [HomeAssistant, str], Awaitable[list[AbstractOAuth2Implementation]] ]  async_provide_implementation 
)
Add an implementation provider.

If no implementation found, return None.

Definition at line 437 of file config_entry_oauth2_flow.py.

◆ async_get_config_entry_implementation()

AbstractOAuth2Implementation homeassistant.helpers.config_entry_oauth2_flow.async_get_config_entry_implementation ( HomeAssistant  hass,
config_entries.ConfigEntry   config_entry 
)
Return the implementation for this config entry.

Definition at line 423 of file config_entry_oauth2_flow.py.

◆ async_get_implementations()

dict[str, AbstractOAuth2Implementation] homeassistant.helpers.config_entry_oauth2_flow.async_get_implementations ( HomeAssistant  hass,
str   domain 
)
Return OAuth2 implementations for specified domain.

Definition at line 406 of file config_entry_oauth2_flow.py.

◆ async_oauth2_request()

client.ClientResponse homeassistant.helpers.config_entry_oauth2_flow.async_oauth2_request ( HomeAssistant  hass,
dict  token,
str  method,
str  url,
**Any   kwargs 
)
Make an OAuth2 authenticated request.

This method will not refresh tokens. Use OAuth2 session for that.

Definition at line 547 of file config_entry_oauth2_flow.py.

◆ async_register_implementation()

None homeassistant.helpers.config_entry_oauth2_flow.async_register_implementation ( HomeAssistant  hass,
str  domain,
AbstractOAuth2Implementation   implementation 
)
Register an OAuth2 flow implementation for an integration.

Definition at line 398 of file config_entry_oauth2_flow.py.

Variable Documentation

◆ _LOGGER

homeassistant.helpers.config_entry_oauth2_flow._LOGGER = logging.getLogger(__name__)
private

Definition at line 36 of file config_entry_oauth2_flow.py.

◆ AUTH_CALLBACK_PATH

string homeassistant.helpers.config_entry_oauth2_flow.AUTH_CALLBACK_PATH = "/auth/external/callback"

Definition at line 48 of file config_entry_oauth2_flow.py.

◆ CLOCK_OUT_OF_SYNC_MAX_SEC

int homeassistant.helpers.config_entry_oauth2_flow.CLOCK_OUT_OF_SYNC_MAX_SEC = 20

Definition at line 52 of file config_entry_oauth2_flow.py.

◆ DATA_JWT_SECRET

string homeassistant.helpers.config_entry_oauth2_flow.DATA_JWT_SECRET = "oauth2_jwt_secret"

Definition at line 38 of file config_entry_oauth2_flow.py.

◆ HEADER_FRONTEND_BASE

string homeassistant.helpers.config_entry_oauth2_flow.HEADER_FRONTEND_BASE = "HA-Frontend-Base"

Definition at line 49 of file config_entry_oauth2_flow.py.

◆ MY_AUTH_CALLBACK_PATH

string homeassistant.helpers.config_entry_oauth2_flow.MY_AUTH_CALLBACK_PATH = "https://my.home-assistant.io/redirect/oauth"

Definition at line 50 of file config_entry_oauth2_flow.py.

◆ OAUTH_AUTHORIZE_URL_TIMEOUT_SEC

int homeassistant.helpers.config_entry_oauth2_flow.OAUTH_AUTHORIZE_URL_TIMEOUT_SEC = 30

Definition at line 54 of file config_entry_oauth2_flow.py.

◆ OAUTH_TOKEN_TIMEOUT_SEC

int homeassistant.helpers.config_entry_oauth2_flow.OAUTH_TOKEN_TIMEOUT_SEC = 30

Definition at line 55 of file config_entry_oauth2_flow.py.