HowTo: Node Red – Control Spotify via NodeRed

What I really appreciate about Spotify is the good connectivity. You can play or control music or podcasts on another device with just a few clicks.

Thanks to the free possibility of setting up developer access, many of these functions can also be accessed from NodeRed. With a few cleverly linked nodes, you can easily create your own “Spotify remote control” for (for example) the dashboard.

The control options are of course not limited to the dashboard. The control option could also be triggered, for example, via connected buttons or other options. 🙂

You can find a first approach to this in the following article.

Safety instructions

I know the following hints are always a bit annoying and seem unnecessary. But unfortunately, many people who knew it "better" from carelessness lost their eyes, fingers or other things or hurt themselves. In comparison, a loss of data is almost not worth mentioning, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Even the coolest project is worth no injury or other annoyance.

Affiliate links / advertising links

The links to online shops listed here are so-called affiliate links. If you click on such an affiliate link and shop via this link, receives a commission from the online shop or provider concerned. The price doesn't change for you. If you do your purchases via these links, you will support in being able to offer further useful projects in the future. 🙂


Helpful Articles:
So that you can install new nodes, NodeRed should of course already be installed.
How to prepare a RaspberryPi and then install NodeRed on it is described in the following articles.

Required tools:

Required material:

In the following list you will find all the parts you need to implement this article.

Log in to the NodeRed configuration interface

Before you can edit your NodeRed configuration you must - if activated - first log in to the NodeRed configuration interface.

View of the login screen. Here you have to enter the login details that you entered during the configuration of the login. Information about this can be found in the article NodeRed - User Login Setup.


First of all, thanks to gelo2002 for his flow. The NodeCode offered below is based on its free shared code. I just added a few (useful in my opinion) extensions. The main work has been done by gelo2002. 🙂

You can find information about his flow here:
or here

Install the needed nodes

So that NodeRed can communicate with your Spotify-Account you have to install the node

  • node-red-contrib-spotify

How nodes are installed is described in the article NodeRed – Installing new nodes.

Activate the Spotify Developer account

So that you can control the various functions of your Spotify account, you must first set up a developer account for your Spotify account. This is free of chage and is done with a few clicks. 🙂

To do this, go to the start page of your Spotify Developer Portal. You can use the following link:

After logging in with your account data, you must first accept or confirm the “Conditions”.

Then click on “Create App” …

… and enter a name and a suitable description for it. You can choose both as you like, but of course they should be reasonably meaningful. 🙂

Then you will be redirected to the overview of this “app” (this is what Spotify calls the developer access). There you will find the “ClientID” and the “ClientSecret” on the left. You will need both laterso you should write them down somewhere.

After you have clicked on “Edit Settings” in the overview, you will be directed to the view shown. There you have to enter the appropriate “Redirect Uri”. This Redirect Uri depends on the address of your NodeRed server.

If this can be reached, for example, at the address https://, the Redirect Uri would be as follows:

  • https://

Make sure that you select the correct protocol (i.e. http or https).

If you have entered the correct link, all you have to do is click on “Add” and (below) on “Save”.

Insert NodeCode

Now to the actual NodeCode. This includes the control of the simplest functions. So you can pause and continue playback, select the next or previous track, “scroll” in the song and get the album cover displayed.

As always, you can find the NodeCode in the following part in the Nerdiy Git repository under:

View of the NodeRed Flow.
View of the control buttons in the Dashboard.

Enter account access data in NodeRed

After you have created a developer access to your Spotify and inserted the NodeCode, you can now switch to your NodeRed configuration. Click on one of the Spotify nodes there and start configuring a new access there.

Now you have to enter your ClientID in the text field next to “ClientID” and your client secret in the text field next to “Client secret”.

You can find both in the previous step in your Spotify Developer access.

Next you have to enter the desired “Scopes”. Scopes stand for the services that you want to control from NodeRed.

For this flow here you can enter the following scopes:


You can find a complete list at:

As soon as you have entered the scopes, all you have to do is click on “Start Authentication”.

This will open a new window in which you now have to confirm that you have allowed your NodeRed to access your Spotify account.

If you get an error message at this point, you can find a solution in the paragraph “Solution for error” INVALID_CLIENT: Invalid redirect URI “. 🙂

After you have confirmed this, you will be redirected to a website on which only the short message “spotify: authorized” is displayed.

Solution for error “INVALID_CLIENT: Invalid redirect URI”

The solution to the error reporting: INVALID_CLIENT: Invalid redirect URI I found here:

In principle, the error is caused by the fact that the “Redirect URI” was not configured correctly in the developer account. To get the correct Redirect URI, you can use the following trick.

Enter your URI in the URL decoder ( and let it decode.

The marked part in the lower field then corresponds to the Redirect URI, which you have to enter in your Spotify account.

The Spotify playback jumps or stalls sometimes

Every now and then it happens that the playback on one of my devices (no matter which one) jumps or stops. By trying it out, I found out that this seems to be related to the linking of the Spotify account with external services (for example the NodeCode presented here).

In retrospect, I explain it like this: Because Spotify wants to keep the playback data synchronized on all connected participants, I can imagine that a participant who answers too slowly could bring this synchronization out of sync.

Long story short: If you also observe this error: For me it helped to restart the computer on which NodeRed is running or, in the “worst case”, to unlink the Spotify account.

Have fun with the project

I hope everything worked as described. If not or you have any other questions or suggestions, please let me know in the comments. Also, ideas for new projects are always welcome. 🙂

P.S. Many of these projects - especially the hardware projects - cost a lot of time and money. Of course I do this because I enjoy it, but if you appreciate it that I share these information with you, I would be happy about a small donation to the coffee box. 🙂

Buy Me a Coffee at   


  1. Hast du Playback Transfer auf ein anderes Gerät zum Laufen bekommen? In der vorletzten Version schickte man da einfach ganz stupide die Geräte ID samt Play Befehl auf die TransferMyPlayback API – nun tut sich da nix mehr.

    1. Moin Steven,
      habe ich tatsächlich noch nicht ausprobiert. Hast du mal die API von Spotify gecheckt ob es da Infos zu gibt?
      Beste Grüße

  2. Hi Fab,

    I was wondering how you select a playlist or song to begin with? I am a bit confused about this. It seems like you have somehow already configured the spotify node to get a playlist/song.

    1. Hi Asad,
      currently I use this only to display information of the current playing song. Selecting the song and co is done via the smartphone/desktop app of spotify. Nevertheless it is also possible to do this via the spotify node. 🙂
      Best regards

      1. Thank you for your response. I’m a bit confused as to how you would enable that. There doesn’t seem to be a specific way to do this. Do you have a tutorial that selects the song via the spotify node?


        1. Hi Asad,
          unfortunately not (yet). But I will put it on my list and will try to prepare something like this soon. 🙂
          Best regards

Leave a Reply

Your email address will not be published. Required fields are marked *