spotcast icon indicating copy to clipboard operation
spotcast copied to clipboard

Could not get spotify token

Open midunker opened this issue 1 year ago • 11 comments

Hi, I had a working spotcast integration since month and I didn’t change anything. Suddenly I got an error message:

Failed to call service spotcast.start. Could not get spotify token.

And the log entry:

Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/connection.py:301
Integration: Home Assistant WebSocket API ([documentation](https://www.home-assistant.io/integrations/websocket_api), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+websocket_api%22))
First occurred: 8:20:28 PM (2 occurrences)
Last logged: 8:20:31 PM

[547603782336] Error handling message: Could not get spotify token. (home_assistant_error) ... from ... (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36)

The Spotify Integration is working. I tested it in isolation. I also refreshed the sp_key and sp_dc token in the spotcast config. I still get this error and I don’t understand where it comes from.

Any ideas?

midunker avatar Feb 11 '24 19:02 midunker

Got the same, did the same!

SvenSvenApfel avatar Feb 16 '24 21:02 SvenSvenApfel

Same issue here. Spotify website refuses to open in incognito mode so I am unable to renew my token. I suspect this is an intended move from their part. Any idea of a workaround?

Rafaille avatar Feb 18 '24 23:02 Rafaille

Spotify in Incognito works for me.

SvenSvenApfel avatar Feb 19 '24 08:02 SvenSvenApfel

I was able to get a new sp_key and sp_dc. For some reason my device_id also changed. Once restarted, casting worked without issues.

vmartinv avatar Feb 28 '24 01:02 vmartinv

Sorry about the late reply. My initial attempt to visit spotify website was on my phone (desktop mode), I was a bit too naive. I can confirm that the method to get the sp values still work (on a computer browser!). For some reason these values had changed and updating them in spotcast did the trick. Everything is back in order, apologies for the false alarm.

Rafaille avatar Feb 28 '24 23:02 Rafaille

Hi @Rafaille! I think I am having a similar issue with the spotcast integration (see here). Which steps did you specifically follow to get around this error? I am open to any suggestions.

XDKTOOR avatar May 03 '24 19:05 XDKTOOR

Hi @Rafaille! I think I am having a similar issue with the spotcast integration (see here). Which steps did you specifically follow to get around this error? I am open to any suggestions.

Nothing specific really, my mistake was to use my phone. But on a web browser everything is fine. I just followed the normal procedure. What issue are you seeing?

Rafaille avatar May 03 '24 19:05 Rafaille

@Rafaille Oh, okay. Glad it worked out for you. Sadly, I got the error although using my pc. Spotcast failed to call service spotcast start_could not get spotify token

2024-05-03 21:36:16.825 ERROR (MainThread) [custom_components.spotcast.spotcast_controller] Unsuccessful token request, received code 302 and Location header /get_access_token?reason=transport&productType=web_player&_authfailed=1. sp_dc and sp_key could be expired. Please update in config.

Double-checked the sp_dc and ps_key...no typos, nothing (I copy & pasted it from the Spotify developer panel). Even set up a new app, although I'm not sure if I had to completely start over from scratch for it to work.

XDKTOOR avatar May 03 '24 21:05 XDKTOOR

Are you sure you used private mode on your browser and quit the page without logging out?

Rafaille avatar May 03 '24 21:05 Rafaille

@Rafaille Edit: I am trying it right now. I'll keep you updated. Edit: It worked! Have used both keys from the developer panel before, which seems not to work.

Thank you so much! This was the hint I needed!

XDKTOOR avatar May 03 '24 22:05 XDKTOOR

Not the developer portal you need to login to spotify and get the cookie details from there

fcusson avatar May 03 '24 23:05 fcusson