mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 02:37:08 +00:00
Refresh nest access token before before building subscriber Credentials (#138259)
This commit is contained in:
parent
f8763c49ef
commit
9772014bce
@ -50,13 +50,14 @@ class AsyncConfigEntryAuth(AbstractAuth):
|
|||||||
return cast(str, self._oauth_session.token["access_token"])
|
return cast(str, self._oauth_session.token["access_token"])
|
||||||
|
|
||||||
async def async_get_creds(self) -> Credentials:
|
async def async_get_creds(self) -> Credentials:
|
||||||
"""Return an OAuth credential for Pub/Sub Subscriber."""
|
"""Return an OAuth credential for Pub/Sub Subscriber.
|
||||||
# We don't have a way for Home Assistant to refresh creds on behalf
|
|
||||||
# of the google pub/sub subscriber. Instead, build a full
|
The subscriber will call this when connecting to the stream to refresh
|
||||||
# Credentials object with enough information for the subscriber to
|
the token. We construct a credentials object using the underlying
|
||||||
# handle this on its own. We purposely don't refresh the token here
|
OAuth2Session since the subscriber may expect the expiry fields to
|
||||||
# even when it is expired to fully hand off this responsibility and
|
be present.
|
||||||
# know it is working at startup (then if not, fail loudly).
|
"""
|
||||||
|
await self.async_get_access_token()
|
||||||
token = self._oauth_session.token
|
token = self._oauth_session.token
|
||||||
creds = Credentials( # type: ignore[no-untyped-call]
|
creds = Credentials( # type: ignore[no-untyped-call]
|
||||||
token=token["access_token"],
|
token=token["access_token"],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user