Helper to retrieve a Spotify web player access token using the sp_dc cookie.
Uses TOTP authentication with cipher secrets from spot-secrets-go.
- Open a new Incognito window in Chrome at https://accounts.spotify.com/en/login?continue=https:%2F%2Fopen.spotify.com%2F
- Open Developer Tools
- Login to Spotify
- Go to Application tab → Cookies →
https://open.spotify.com - Copy the value of
sp_dc - Close the window without logging out (logging out invalidates the cookie)
-
Set the
SPOTIFY_DCenvironment variable -
Do:
import ( "github.com/mirrorfm/spotify-webplayer-token/app" ) func main() { token, err := app.GetAccessTokenFromEnv() // use token.AccessToken }
-
In the current repo, create
env.jsonsuch as:{ "SPOTIFY_DC": "AQAJJvY80mY--nNZ_vWVMyWrvrSse..." } -
Run:
make setup && make run