Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.google.config_flow.OAuth2FlowHandler Class Reference
Inheritance diagram for homeassistant.components.google.config_flow.OAuth2FlowHandler:
[legend]
Collaboration diagram for homeassistant.components.google.config_flow.OAuth2FlowHandler:
[legend]

Public Member Functions

None __init__ (self)
 
ConfigFlowResult async_oauth_create_entry (self, dict data)
 
ConfigFlowResult async_step_auth (self, dict[str, Any]|None user_input=None)
 
ConfigFlowResult async_step_creation (self, dict[str, Any]|None user_input=None)
 
ConfigFlowResult async_step_reauth (self, Mapping[str, Any] entry_data)
 
ConfigFlowResult async_step_reauth_confirm (self, dict[str, Any]|None user_input=None)
 
dict[str, Any] extra_authorize_data (self)
 
logging.Logger logger (self)
 

Static Public Member Functions

OptionsFlow async_get_options_flow (ConfigEntry config_entry)
 

Public Attributes

 external_data
 
 source
 

Static Public Attributes

 DOMAIN = DOMAIN
 
 None
 

Private Attributes

 _device_flow
 
 _exchange_finished_task
 
 _web_auth
 

Detailed Description

Config flow to handle Google Calendars OAuth2 authentication.

Historically, the Google Calendar integration instructed users to use
Device Auth. Device Auth was considered easier to use since it did not
require users to configure a redirect URL. Device Auth is meant for
devices with limited input, such as a television.
https://developers.google.com/identity/protocols/oauth2/limited-input-device

Device Auth is limited to a small set of Google APIs (calendar is allowed)
and is considered less secure than Web Auth. It is not generally preferred
and may be limited/deprecated in the future similar to App/OOB Auth
https://developers.googleblog.com/2022/02/making-oauth-flows-safer.html

Web Auth is the preferred method by Home Assistant and Google, and a benefit
is that the same credentials may be used across many Google integrations in
Home Assistant. Web Auth is now easier for user to setup using my.home-assistant.io
redirect urls.

The Application Credentials integration does not currently record which type
of credential the user entered (and if we ask the user, they may not know or may
make a mistake) so we try to determine the credential type automatically. This
implementation first attempts Device Auth by talking to the token API in the first
step of the device flow, then if that fails it will redirect using Web Auth.
There is not another explicit known way to check.

Definition at line 45 of file config_flow.py.

Constructor & Destructor Documentation

◆ __init__()

None homeassistant.components.google.config_flow.OAuth2FlowHandler.__init__ (   self)
Set up instance.

Definition at line 78 of file config_flow.py.

Member Function Documentation

◆ async_get_options_flow()

OptionsFlow homeassistant.components.google.config_flow.OAuth2FlowHandler.async_get_options_flow ( ConfigEntry  config_entry)
static
Create an options flow.

Definition at line 237 of file config_flow.py.

◆ async_oauth_create_entry()

ConfigFlowResult homeassistant.components.google.config_flow.OAuth2FlowHandler.async_oauth_create_entry (   self,
dict  data 
)
Create an entry for the flow, or update existing entry.

Definition at line 179 of file config_flow.py.

◆ async_step_auth()

ConfigFlowResult homeassistant.components.google.config_flow.OAuth2FlowHandler.async_step_auth (   self,
dict[str, Any] | None   user_input = None 
)
Create an entry for auth.

Definition at line 100 of file config_flow.py.

◆ async_step_creation()

ConfigFlowResult homeassistant.components.google.config_flow.OAuth2FlowHandler.async_step_creation (   self,
dict[str, Any] | None   user_input = None 
)
Handle external yaml configuration.

Definition at line 171 of file config_flow.py.

◆ async_step_reauth()

ConfigFlowResult homeassistant.components.google.config_flow.OAuth2FlowHandler.async_step_reauth (   self,
Mapping[str, Any]   entry_data 
)
Perform reauth upon an API authentication error.

Definition at line 220 of file config_flow.py.

◆ async_step_reauth_confirm()

ConfigFlowResult homeassistant.components.google.config_flow.OAuth2FlowHandler.async_step_reauth_confirm (   self,
dict[str, Any] | None   user_input = None 
)
Confirm reauth dialog.

Definition at line 227 of file config_flow.py.

◆ extra_authorize_data()

dict[str, Any] homeassistant.components.google.config_flow.OAuth2FlowHandler.extra_authorize_data (   self)
Extra data that needs to be appended to the authorize url.

Definition at line 91 of file config_flow.py.

◆ logger()

logging.Logger homeassistant.components.google.config_flow.OAuth2FlowHandler.logger (   self)
Return logger.

Definition at line 86 of file config_flow.py.

Member Data Documentation

◆ _device_flow

homeassistant.components.google.config_flow.OAuth2FlowHandler._device_flow
private

Definition at line 145 of file config_flow.py.

◆ _exchange_finished_task

homeassistant.components.google.config_flow.OAuth2FlowHandler._exchange_finished_task
private

Definition at line 148 of file config_flow.py.

◆ _web_auth

homeassistant.components.google.config_flow.OAuth2FlowHandler._web_auth
private

Definition at line 83 of file config_flow.py.

◆ DOMAIN

homeassistant.components.google.config_flow.OAuth2FlowHandler.DOMAIN = DOMAIN
static

Definition at line 74 of file config_flow.py.

◆ external_data

homeassistant.components.google.config_flow.OAuth2FlowHandler.external_data

Definition at line 153 of file config_flow.py.

◆ None

homeassistant.components.google.config_flow.OAuth2FlowHandler.None
static

Definition at line 76 of file config_flow.py.

◆ source

homeassistant.components.google.config_flow.OAuth2FlowHandler.source

Definition at line 124 of file config_flow.py.


The documentation for this class was generated from the following file: