mirror of
https://github.com/Andre0512/pyhOn.git
synced 2025-05-14 07:04:26 -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
|
@ -48,7 +48,6 @@ class HonAuth:
|
|||
email: str,
|
||||
password: str,
|
||||
device: HonDevice,
|
||||
refresh_token: str = "",
|
||||
) -> None:
|
||||
self._session = session
|
||||
self._request = HonAuthConnectionHandler(session)
|
||||
|
@ -58,7 +57,6 @@ class HonAuth:
|
|||
self._device = device
|
||||
self._expires: datetime = datetime.utcnow()
|
||||
self._auth = HonAuthData()
|
||||
self._auth.refresh_token = refresh_token
|
||||
|
||||
@property
|
||||
def cognito_token(self) -> str:
|
||||
|
@ -201,7 +199,7 @@ class HonAuth:
|
|||
if access_token := re.findall("access_token=(.*?)&", text):
|
||||
self._auth.access_token = access_token[0]
|
||||
if refresh_token := re.findall("refresh_token=(.*?)&", text):
|
||||
self._auth.refresh_token = refresh_token[0]
|
||||
self._auth.refresh_token = parse.unquote(refresh_token[0])
|
||||
if id_token := re.findall("id_token=(.*?)&", text):
|
||||
self._auth.id_token = id_token[0]
|
||||
return bool(access_token and refresh_token and id_token)
|
||||
|
@ -266,7 +264,9 @@ class HonAuth:
|
|||
except exceptions.HonNoAuthenticationNeeded:
|
||||
return
|
||||
|
||||
async def refresh(self) -> bool:
|
||||
async def refresh(self, refresh_token="") -> bool:
|
||||
if refresh_token:
|
||||
self._auth.refresh_token = refresh_token
|
||||
params = {
|
||||
"client_id": const.CLIENT_ID,
|
||||
"refresh_token": self._auth.refresh_token,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue