busybox11 / spotify-websocket-client

Simple Spotify websocket client for simple projects use

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

spotify-websocket-client

How to use?

  1. Create an app on Spotify's developer portal. [Instructions on Spotify's official developer documentation and guides website}(https://developer.spotify.com/documentation/web-api/concepts/apps).
  • 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.
  • With NodeJS (most common) : npm i
  • With pnpm : pnpm i
  • With bun (recommended for high efficiency) : bun i
  1. Run the login script (login.js) with node or bun and follow the instructions.
  2. After filling the REFRESH_TOKEN environment variable, you can now run the index.js 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.

About

Simple Spotify websocket client for simple projects use


Languages

Language:JavaScript 100.0%