mirror of
https://github.com/Andre0512/pyhOn.git
synced 2025-05-31 06:48:24 -04:00
Fix problems with refresh token
This commit is contained in:
parent
767cbe35de
commit
c4e8038652
4 changed files with 9 additions and 8 deletions
|
@ -22,9 +22,9 @@ class HonConnectionHandler(ConnectionHandler):
|
|||
self,
|
||||
email: str,
|
||||
password: str,
|
||||
session: Optional[aiohttp.ClientSession] = None,
|
||||
mobile_id: str = "",
|
||||
refresh_token: str = "",
|
||||
session: Optional[aiohttp.ClientSession] = None,
|
||||
) -> None:
|
||||
super().__init__(session=session)
|
||||
self._device: HonDevice = HonDevice(mobile_id)
|
||||
|
@ -54,11 +54,12 @@ class HonConnectionHandler(ConnectionHandler):
|
|||
self._email,
|
||||
self._password,
|
||||
self._device,
|
||||
refresh_token=self._refresh_token,
|
||||
)
|
||||
return self
|
||||
|
||||
async def _check_headers(self, headers: Dict[str, str]) -> Dict[str, str]:
|
||||
if self._refresh_token:
|
||||
await self.auth.refresh(self._refresh_token)
|
||||
if not (self.auth.cognito_token and self.auth.id_token):
|
||||
await self.auth.authenticate()
|
||||
headers["cognito-token"] = self.auth.cognito_token
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue