Skip to content

Commit

Permalink
Fix refresh token maximum exceeded
Browse files Browse the repository at this point in the history
  • Loading branch information
cyr-ius committed Apr 24, 2023
1 parent 21faf9b commit 27e75b7
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions audiconnectpy/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,18 +441,15 @@ async def async_get_headers(
)
token_type = "mbb"

await self.async_refresh_tokens()
match token_type:
case "idk":
token = self._idk_token.get("access_token")
case "mbb":
token = self._mbb_token.get("access_token")
case "audi":
token = self._audi_token.get("access_token")
case "no":
token = None

if token:
if token_type in ["mbb", "idk", "audi"]:
await self.async_refresh_tokens()
match token_type:
case "idk":
token = self._idk_token.get("access_token")
case "mbb":
token = self._mbb_token.get("access_token")
case "audi":
token = self._audi_token.get("access_token")
defaults.update({"Authorization": f"Bearer {token}"})
if self._x_client_id:
defaults.update({"X-Client-ID": self._x_client_id})
Expand Down

0 comments on commit 27e75b7

Please sign in to comment.