Spotify OAuth through Node Red not working at all - help!

Hello everyone - I am trying to replicate this setup in Lovelace and have come completely unstuck trying to get Spotify to authorise. I simply cannot get Spotify to get past an “Illegal scope” response.

Steps so far - I have been to developer.spotify.com and made my application, got my client_id, client_secret, and been editing the Redirect URIs. HA is working; Node-Red is installed and working with node-red-contrib-home-assistant-websocket and node-red-contrib-spotify; my Spotify account is automatically detected by HA, as is my Sonos system; my Spotify account is Premium Family.

configuration.yaml

spotify:
  client_id: !secret SPOTIFY_CLIENT_ID
  client_secret: !secret SPOTIFY_CLIENT_SECRET

A few things I have tried so far with the redirect URIs (I think I tried everything) in every post on the net.

All this and I just get Illegal scope - every. time.

My general level of experience with computers is pretty high, I am a bit of an HA beginner though. I am starting to think something else is wrong here, not just the URI, Node-Red and Spotify. What am I missing?

To try something different I removed the existing Spotify integration, deleted Spotify from configuration.yaml and ran the updates to HA (Core 2021.11.4, Supervisor 2021.10.8), which gave a few reboots of course. Spotify is gone.

The reinstall has Spotify authenticating correctly in HA - Spotify is rediscovered and following the docs gives the magic there - the authentication runs through no problem.

But even with Spotify integration authenticated the Node-Red OAuth request still gives Illegal Scope. As before trying various URIs leads to precisely the same result.

Still got no idea how to fix this.

Did you also add all the scopes you actually need into your Oauth2 in NodeRed?

image

Aaaah - that was it - the scope we want here is that one… Thank you for that hint.

Choosing playlist-read-private Now I get to a 401 Unauthorized but that is a step forward.

Edit - just re-entering the ‘unauthorized’ link gave the token time to settle into its home and Spotify is now authorised.

Thank you, thank you :partying_face:

1 Like