Skip to content

Latest commit

 

History

History
45 lines (29 loc) · 1.71 KB

README.md

File metadata and controls

45 lines (29 loc) · 1.71 KB

spotify-websocket-client

Installation

This project uses bun as a package manager and runtime.

Install the project dependencies using bun:

bun install

Initial setup

bun run login.ts

Follow the instructions to login to Spotify.

Usage

Make sure you have the necessary environment variables set, and the run:

bun start

Instructions

  1. Create an app on Spotify's developer portal. Instructions on Spotify's official developer documentation and guides website.
  • You must set http://localhost:35679/callback as a valid Redirect URI.
  1. Fill the required initial environment variables for login: SPOTIFY_REDIRECT_URI, SPOTIFY_CLIENT_ID and SPOTIFY_CLIENT_SECRET. Instructions below.
  2. Install the dependencies.
  3. Run the login script (login.ts) with bun and follow the instructions.
  4. After filling the REFRESH_TOKEN environment variable, you can now run the index.ts file to host the websocket server. Enjoy!

Environment variables

  • 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 the login.js script.