This project uses bun as a package manager and runtime.
Install the project dependencies using bun:
bun installbun run login.tsFollow the instructions to login to Spotify.
Make sure you have the necessary environment variables set, and the run:
bun start- Create an app on Spotify's developer portal. Instructions on Spotify's official developer documentation and guides website.
- You must set
http://localhost:35679/callbackas a valid Redirect URI.
- Fill the required initial environment variables for login:
SPOTIFY_REDIRECT_URI,SPOTIFY_CLIENT_IDandSPOTIFY_CLIENT_SECRET. Instructions below. - Install the dependencies.
- Run the login script (
login.ts) withbunand follow the instructions. - After filling the
REFRESH_TOKENenvironment variable, you can now run theindex.tsfile to host the websocket server. Enjoy!
SPOTIFY_REDIRECT_URI: Keep the default -http://localhost:35679/callback. You must set this up as part of your app for the initial login process. (No callback server needs to be hosted at all times)SPOTIFY_CLIENT_ID: Your Spotify app Client ID. Can be found inside your app's page on Spotify's developer portal.SPOTIFY_CLIENT_SECRET: Your Spotify app Client Secret. Can be found below the Client ID inside your app's page on Spotify's developer portal. It will never be exposed to the clients.REFRESH_TOKEN: Will be setup as part of the initial login process when executing thelogin.jsscript.