-
Notifications
You must be signed in to change notification settings - Fork 1
Spotify
BluDood edited this page Dec 29, 2025
·
3 revisions
If you would like to enable the /spotify and /ws endpoints, you'll have to do some steps to set them up.
This is required to get a "user" token, which is needed for live fetching of player status.
- Open https://open.spotify.com and log in if you haven't already
- Open DevTools in your browser (usually CTRL+SHIFT+I)
- Go to
Storage(Firefox), orApplication(Chrome/derivatives) - Go to
Cookies,https://open.spotify.com, and search upsp_dc - Copy the value
These credentials are used for fetching the full playback info when an update is received.
You can use SpotiRT to simplify this process. Make sure to enable the Read access to a user's player state scope!
Follow the steps, and copy your client ID, client secret, and refresh token.
Once you've retreived your sp_dc cookie and your application credentials, put them in your .env file like so:
SPOTIFY_DC="your_cookie"
SPOTIFY_CLIENT_ID="your_client_id"
SPOTIFY_CLIENT_SECRET="your_client_secret"
SPOTIFY_REFRESH_TOKEN="your_refresh_token"
Restart the API if it's already running, and the /spotify endpoint should be available! You can also now get live updates by listening to the /ws WebSocket endpoint.