To turn on Spotify integration you will need additional setup with Spotify to use the Spotify API.
- Go to https://developer.spotify.com/dashboard.
- Log into Spotify with your user account if you are not already logged in.
- Click the button in the upper right labeled "Create App".
- Fill in the form, making sure the Redirect URI is
http://127.0.0.1:PORT/callback, wherePORTis a previously unused four-digit port number you choose for the authorization redirect. - Click the settings button and copy down the Client ID and Client Secret (the client secret requires you to click 'View client secret').
- In your
config.local.yaml, set the Spotify credentials under thespotifysection (seeconfig.sample.yaml):The legacyspotify: clientId: <your-client-id> clientSecret: <your-client-secret> port: <PORT> # must match the redirect URI you registered in step 4
.envfile is also still supported: setSPOTIFY_APP_CLIto your Client ID,SPOTIFY_APP_CLISECto your Client Secret, andSPOTIFY_APP_PORTto the port from step 4. - While your Spotify app is in Development Mode, open the app's User Management page on the dashboard and add the Spotify account(s) that will use the integration. Accounts that are not on this allowlist will get
403 Forbiddenfrom most Web API endpoints.
Note
Several Web API endpoints (playback control, playlist read/write, the Web Playback SDK) require a Spotify Premium account. Free accounts can sign in but most actions will fail.
The player agent (package name music) implements Spotify support. Enable it like any other agent, then do a one-time OAuth login:
- Enable the agent:
@config agent player on - Authenticate:
@player spotify login— this opens the browser for a one-time authorization. Afterward, the refresh token is stored (DPAPI-encrypted on Windows, Keychain on macOS, libsecret on Linux via@azure/msal-node-extensions) at$(HOME)/.typeagent/profiles/<profile>/player/token, so subsequent runs mint access tokens without prompting. - (Optional) Load Spotify listening history:
@player spotify load <path-to-history-file> - To clear the cached token:
@player spotify logout - To disable the agent entirely:
@config agent player off
To actually hear audio, an active Spotify client must be running and signed in as the same user (the Spotify desktop app, mobile app, or any browser tab on open.spotify.com) — the agent controls playback on whichever device Spotify reports as active.
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.