- Create an application in the Spotify Developer Dashboard
- Click on the
Edit settingsbutton - Set the
Redirect URIsto a convenient location (doesn't matter) - Save the given
Client IDalong with theClient Secret
- Click on the
- Retrieve the access code
- Visit the following URL after replacing
$CLIENT_ID,$SCOPE, and$REDIRECT_URI
https://accounts.spotify.com/authorize?response_type=code&client_id=$CLIENT_ID&scope=$SCOPE&redirect_uri=$REDIRECT_URI
- You can choose scope(s) by visiting the Spotify API docs
- Visit the following URL after replacing
- Note
codefrom the URL you were redirected to - Acquire your refresh token
- Run the following CURL command
curl -X POST https://accounts.spotify.com/api/token -d "client_id=$CLIENT_ID&client_secret=$CLIENT_SECRET&grant_type=authorization_code&code=$CODE&redirect_uri=$REDIRECT_URI"- Either replace or export the variables in your shell (
$CILENT_ID,$CLIENT_SECRET,$CODE, and$REDIRECT_URI)
- Save
refresh_tokenin your.envfile as well as yourclient_idandclient_secret.
Created
May 20, 2023 13:48
-
-
Save skidoodle/9a9dc9c8802434f7fc0da94ebe4dba18 to your computer and use it in GitHub Desktop.
How to get your Spotify tokens
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment