Skip to content

Commit

Permalink
Merge pull request #408 from Gramatus/302_info
Browse files Browse the repository at this point in the history
Check for 302 status with a redirect to &_authfailed=1 in token request
  • Loading branch information
fcusson authored Jan 3, 2024
2 parents bba7e34 + 7f0da8a commit 078fe62
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions custom_components/spotcast/spotcast_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,14 @@ async def start_session(self):
allow_redirects=False,
headers=headers
) as response:
if (response.status == 302 and response.headers['Location'] == '/get_access_token?reason=transport&productType=web_player&_authfailed=1'):
_LOGGER.error(
"Unsuccessful token request, received code 302 and "
"Location header %s. sp_dc and sp_key could be "
"expired. Please update in config.",
response.headers['Location']
)
raise HomeAssistantError("Expired sp_dc, sp_key")
if (response.status != 200):
_LOGGER.info(
"Unsuccessful token request, received code %i",
Expand Down

0 comments on commit 078fe62

Please sign in to comment.