Generate a Spotify refresh_token right from the terminal
Requires Node.js 20 or later.
npm install --global spotify-rtoken-cliGrab the client_id, client_secret and redirect_uri of your Spotify app, then run the CLI and follow the prompts:
$ spotify-rtokenThe CLI opens the Spotify authorization page in your browser. After you approve, Spotify redirects to your redirect_uri with a code query parameter - copy that code, paste it back into the terminal, and the generated refresh_token is copied straight to your clipboard. No credentials are stored locally.
| Option | Default | Description |
|---|---|---|
--no-mask |
false |
Do not hide/mask credentials i.e. client_id, client_secret, code. |
- spotify-mini: Fetch your currently playing, recent and top Spotify tracks in Node.js.
MIT 2022-2026 © Rocktim Saikia