Fix sync oath2 scaffold template (#46219)
This commit is contained in:
parent
6f446cf627
commit
568180632e
2 changed files with 4 additions and 8 deletions
|
@ -65,7 +65,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
|||
session = config_entry_oauth2_flow.OAuth2Session(hass, entry, implementation)
|
||||
|
||||
# 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
|
||||
hass.data[DOMAIN][entry.entry_id] = api.AsyncConfigEntryAuth(
|
||||
|
|
|
@ -4,7 +4,7 @@ from asyncio import run_coroutine_threadsafe
|
|||
from aiohttp import ClientSession
|
||||
import my_pypi_package
|
||||
|
||||
from homeassistant import config_entries, core
|
||||
from homeassistant import core
|
||||
from homeassistant.helpers import config_entry_oauth2_flow
|
||||
|
||||
# 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__(
|
||||
self,
|
||||
hass: core.HomeAssistant,
|
||||
config_entry: config_entries.ConfigEntry,
|
||||
implementation: config_entry_oauth2_flow.AbstractOAuth2Implementation,
|
||||
oauth_session: config_entry_oauth2_flow.OAuth2Session,
|
||||
):
|
||||
"""Initialize NEW_NAME Auth."""
|
||||
self.hass = hass
|
||||
self.config_entry = config_entry
|
||||
self.session = config_entry_oauth2_flow.OAuth2Session(
|
||||
hass, config_entry, implementation
|
||||
)
|
||||
self.session = oauth_session
|
||||
super().__init__(self.session.token)
|
||||
|
||||
def refresh_tokens(self) -> str:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue