Arduino library for integrating with a subset of the Spotify Web-API (Does not play music)
Work in progress library - expect changes!
Working well
Working well
Unknown, there is an example that has not been tested in a while. If you get it to run feel free to let me know!
I have put a lot of effort into creating Arduino libraries that I hope people can make use of. If you enjoy my work, please consider becoming a Github sponsor!
The Library supports the following features:
- Get Authentication Tokens
- Getting your currently playing track
- Player Controls:
- Next
- Previous
- Seek
- Play (basic version, basically resumes a paused track)
- Play Advanced (play given song, album, artist)
- Pause
- Set Volume (doesn't seem to work on my phone, works on desktop though)
- Set Repeat Modes
- Toggle Shuffle
- Get Devices
- Better instructions for how to set up your refresh token.
- Example where refresh token and full operation are handled in same sketch.
- Sign into the Spotify Developer page
- Create a new application. (name it whatever you want)
- You will need to use the "client ID" and "client secret" from this page in your sketches
- You will also need to add a callback URI for authentication process by clicking "Edit Settings", what URI to add will be mentioned in further instructions
Spotify's Authentication flow requires a webserver to complete, but it's only needed once to get your refresh token. Your refresh token can then be used in all future sketches to authenticate.
Because the webserver is only needed once, I decided to seperate the logic for getting the Refresh token to it's own examples.
Follow the instructions in one of the following examples to get your token.
- ESP8266
- ESP32
- WiFiNINA (Nano 33 IOT) - Help needed to create an example
Note: Once you have a refresh token, you can use it on either platform in your sketches, it is not tied to any particular device.
Take one of the included examples and update it with your WiFi creds, Client ID, Client Secret and the refresh token you just generated.
By default the getRefreshToken examples will include the required scopes, but if you want change them the following info might be useful.
put a %20
between the ones you need.
Feature | Required Scope |
---|---|
Current Playing Song Info | user-read-playback-state |
Player Controls | user-modify-playback-state |
Download zip from Github and install to the Arduino IDE using that.
- V6 of Arduino JSON - can be installed through the Arduino Library manager.