- Fork this repository
- Rename it to your username
- Modify the
vercel.json
file to referenceyourpseudo/yourpseudo
- Navigate to Spotify Dashboard and create a new app.
- Click, edit settings and add those redirect URIs:
http://localhost:3000/api/auth
http://localhost:3000/callback
- You'll now get a
SPOTIFY_CLIENT_ID
and aSPOTIFY_CLIENT_SECRET
. Store them for later.
- Go to the root of the forked repository.
- Run
npm install
- Copy
.env.example
into.env
and register yourSPOTIFY_CLIENT_ID
andSPOTIFY_CLIENT_SECRET
. - Run
node ./scripts/generateRefreshToken.js
- A web page will open with the refresh token and your .env will be populated by the refresh token. Store it for later.
- Sign up or Sign in to use Vercel for hosting the repo.
- In your dashboard, click on import a repository.
- Copy/Paste your readme's repository URL.
- Navigate to your deployment on Vercel and click on Settings, then click on "Environment Variables"
- Insert the following Variable names and insert your values from the previous steps
Name: SPOTIFY_CLIENT_ID
Value: MY_CLIENT_ID
Name: SPOTIFY_CLIENT_SECRET
Value: MY_SECRET_ID
Name: SPOTIFY_REFRESH_TOKEN
Value: MY_REFRESH_TOKEN
- Play a music on spotify, head to
yourdeployedappurl/now-playing
. You should see the music you're playing. - Head to
https://yourdeployedappurl.vercel.app/top-played
. You should see your top played music.