400 error on login.
See original GitHub issueHave tested creds on spotify web player as well as spotify dev portal, but still getting the following error:
“400 Client Error: Bad Request for url: https://accounts.spotify.com/api/login”
configuration in configuration.yaml is:
spotcast:
username: !secret spotify_username
password: !secret spotify_password
accounts:
alan:
username: !secret spotify_username
password: !secret spotify_password
Have tried with and without the accounts:
section. Made sure both secrets and config don’t contain any leading/trailing spaces or other characters.
Running hass.io .108.9 and spotcast 2.91 (says 2.92 is available but requires hass .109 (which isn’t available yet). Ubuntu 18.04 on NUC.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:8
- Comments:33 (10 by maintainers)
Top Results From Across the Web
How to Fix a 400 Bad Request Error (Causes and Fixes) - Kinsta
The 400 (Bad Request) status code indicates that the server cannot or will not process the request due to something that is perceived...
Read more >How to Fix a 400 Bad Request Error: 8 Easy Methods
The 400 bad request error is an HTTP status code that describes an error caused by an invalid request. Thus, the server can't...
Read more >How to Fix the 400 Bad Request Error - Lifewire
The 400 Bad Request error means that the request you sent to the website server to view the page was somehow incorrect.
Read more >What is a 400 Bad Request Error (and How Can I Fix It)?
A 400 Bad Request Error occurs when a request sent to the website server is incorrect or corrupt, and the server receiving the...
Read more >What is HTTP error 400 and how do you fix it? - IT PRO
This error can indicate that a request has not been met successfully, or that the remote server that received the request was unable...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It seems like a dead end with the current way to obtain an access_token since it would require bypassing Google Recaptcha.
I’ve hacked together a potential workaround. Instead of using username and password to obtain a token, I instead use two cookies that are set just after logging in called
sp_dc
andsp_key
. It does require a manual step to obtain these cookies and they are valid for 1 year. Spotify use them to refresh the access token when it expires after 1 hour.You can checkout how to obtain the access token with the cookies here. https://github.com/petergp/spotify-webplayer-token/blob/master/spotify_token.py
I’ll be testing this the next couple of days. You can find a working fork here: https://github.com/petergp/spotcast/
To obtain the cookies manually: • Open https://accounts.spotify.com/en/login • Open network developer tools in your browser (might require developer menu to be enabled) • Login to Spotify and select Web Player • Search/Filter for
get_access_token
on the network list in Developer tools • Under cookies for the request findsp_dc
andsp_key
.Add these to your
configuration.yaml
How long do the web tokens last?
Could one use manual steps to generate a token via a browser login and then store that rather?