mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 14:17:45 +00:00
Fix sync oath2 scaffold template (#46219)
This commit is contained in:
parent
6f446cf627
commit
568180632e
@ -65,7 +65,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
|||||||
session = config_entry_oauth2_flow.OAuth2Session(hass, entry, implementation)
|
session = config_entry_oauth2_flow.OAuth2Session(hass, entry, implementation)
|
||||||
|
|
||||||
# If using a requests-based API lib
|
# If using a requests-based API lib
|
||||||
hass.data[DOMAIN][entry.entry_id] = api.ConfigEntryAuth(hass, entry, session)
|
hass.data[DOMAIN][entry.entry_id] = api.ConfigEntryAuth(hass, session)
|
||||||
|
|
||||||
# If using an aiohttp-based API lib
|
# If using an aiohttp-based API lib
|
||||||
hass.data[DOMAIN][entry.entry_id] = api.AsyncConfigEntryAuth(
|
hass.data[DOMAIN][entry.entry_id] = api.AsyncConfigEntryAuth(
|
||||||
|
@ -4,7 +4,7 @@ from asyncio import run_coroutine_threadsafe
|
|||||||
from aiohttp import ClientSession
|
from aiohttp import ClientSession
|
||||||
import my_pypi_package
|
import my_pypi_package
|
||||||
|
|
||||||
from homeassistant import config_entries, core
|
from homeassistant import core
|
||||||
from homeassistant.helpers import config_entry_oauth2_flow
|
from homeassistant.helpers import config_entry_oauth2_flow
|
||||||
|
|
||||||
# TODO the following two API examples are based on our suggested best practices
|
# TODO the following two API examples are based on our suggested best practices
|
||||||
@ -18,15 +18,11 @@ class ConfigEntryAuth(my_pypi_package.AbstractAuth):
|
|||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
hass: core.HomeAssistant,
|
hass: core.HomeAssistant,
|
||||||
config_entry: config_entries.ConfigEntry,
|
oauth_session: config_entry_oauth2_flow.OAuth2Session,
|
||||||
implementation: config_entry_oauth2_flow.AbstractOAuth2Implementation,
|
|
||||||
):
|
):
|
||||||
"""Initialize NEW_NAME Auth."""
|
"""Initialize NEW_NAME Auth."""
|
||||||
self.hass = hass
|
self.hass = hass
|
||||||
self.config_entry = config_entry
|
self.session = oauth_session
|
||||||
self.session = config_entry_oauth2_flow.OAuth2Session(
|
|
||||||
hass, config_entry, implementation
|
|
||||||
)
|
|
||||||
super().__init__(self.session.token)
|
super().__init__(self.session.token)
|
||||||
|
|
||||||
def refresh_tokens(self) -> str:
|
def refresh_tokens(self) -> str:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user