Using Spotify through Node Red

I managed to authenticate spotify using the config in the config.yaml file, but I am struggling to authenticate when using Node Red ( node-red-contrib-spotify 0.1.2 ).

Can someone kindly guide me?

1 Like

Same problem here, cant authenticate NR node, always INVALID_CLIENT: Invalid redirect URI
Tried all the combinations on the Developer dashboard, between ip/dns and http/https,

Thanks for the help!

1 Like

Hi Guys @servido @mouthpiec I think I’ve solved it by adding to the Spotify Developer Dashboard > Edit Settings > Redirect URIs the ip of my HA in the callback http://HASSIOIP:1880/spotify-credentials/auth/callback

If you need any other info check this link

HI, longtime no reply. But I am trying to get this going in node-red. I do this:

And I have in the URI on spotify:

anything else I try is not working… If I go to that URL I get:

And clicking on “start Authentication” gives me:

Whats wrong? I have read everything on the forum and official site ( but seem to not find a solution.
Also not clear what these are for exactly:

same issue for me …

What I ultimately would like to achieve is this:

Since an alexa is coupled to 1 alexa account and all of them are connected to mine I can play Spotify easy to them. But my wife and kids can’t with the family spotify. They just don’t see the alexas. And this is a widely known “error”.

I thought of making some players in my profile I would be able to kick playing by node red when saying “alexa turn on spot kidname” (or something similar :sweat_smile:) and then play a list via my profile on alexa…

maybee possible after correct integration in node red ? for the moment i don’t know how to configure it differently

No one can help?

i found that it seems to work :wink:

When you get this Invalid redirect URI page, copy the URL from that page
Open and paste the URL in the top box and encode the URL
Copy the URL after the part …&redirect_uri= and before the next & (e.g. &state=)
Enter this URI in your spotify app in the redirect URI
For homeassistant users, it could look something like this:

Hope this may help others as well.

Found the solution here:

1 Like

appreciate the answer.

i have tried all I could but still no luck.

I see in your links it points to “8123” port and not 1880 port. How is that correct if I use node red running on 1880?

What do you have in the "“scopes” field in node-red? And what should happen when I click “authenticate” in node-red?

I get:
INVALID_CLIENT: Invalid client

update: remove the oauth and now working. I REALLY DONT KNOW WHAT IT WAS I DID…


Ok, now the next thing.

How to proceed now to use this… :slight_smile:

you can find a flow example on google but for the moment i don’t use it …

Hi, I am further. Can play, pause, can next, skip etc. And I can do a “transferMyPlayback” to another device (alexa) via the device id.

Only thing not wokring for me i how to find and how to select waht playlist to play there…

Like this:

What should I put in the function node and how do I get a playlist id?

This does not work:
msg.params = [ {playlistId: "37i9dQZF1DWXmlLSKkfdAk"} ]; return msg;
and a lot of others also not :slight_smile:
gives me:
{"_msgid":"2b1aaff.8d8e15","topic":"","payload":true,"params":[{"playlistId":"37i9dQZF1DWXmlLSKkfdAk"}],"error":"WebapiError: Bad Request"}

I’m having trouble finding examples, or getting the function node to supply the correct information for just simple things like specifying a playlist too.

Would you mind posting how you managed to do play pause, etc. and transfer my playback, please?

Edit: OK, I found another post with more examples: Spotify node-red interface

You an get the deviceids by sending a string of ‘true’ to get my devices, then looking at the debug console.

Then as above, use a function node with:

msg.params = [
    { play: true }
return msg;


msg.params = [ "3XubkIrRsDkykhyRsr8" ]; return msg;

in the function node for ‘getPlaylist’ returns my playlist in an array, but doesn’t play that playlist.

The same works for getPlaylistTracks

You can find the Spotifyid of the playlist by clicking on the 3 dots next to your playlist, then share, then copy spotify URI

Edit: Ok, you need to use play, rather than getPlaylist, and put this in the function node replacing your playlist uri

msg.params = [ {context_uri: "spotify:playlist:3XubktkkgujSVzMRsr8"} ]; return msg;

For setShuffle you need:

msg.params = [ "true" ]; return msg;

where true is to turn on shuffle. That’s probably enough edits for one post today. :slight_smile: Hope it helps.

Thing is the device ids randomly change now and then and I do not know why…

That’s alarming, and certainly puts a spanner in the works of automation. What sort of device is changing device ID? So far I’ve only used my computer, and a bunch of Alexas, but they haven’t changed so far… touch wood, but then again I’ve only just started using it.

The getmydevices node might be able to help with automation, but it will take someone with more nous than me to pass variables. Another option might be able to use Home Assistant itself, with Spotcast…despite the name, it isn’t just a chromecast thing, but can broadcast to Alexas, computers, et cetera

For me only alexas change… and no answer so far…

Thanks for this. It solved my problems with invalid URI but now I have another issue. After agreeing to the permissions all I get is “401: Unauthorized.” Anyone have an idea why?

My Spotify integration within HA is working without any issues, I just can’t seem to get this to work in Node Red.

hello friend please help me to make a flow to play a playlist on my google mini

What have you done yourself?