Spotify Component - Bad URI

I am having problems configuring Spotify component. I have created my app and got my client id and secret. I now can see the configure link on my page but when I click to authorize I get this message “INVALID_CLIENT: Invalid redirect URI”. I have followed the instructions and entered in my URL per the Spotify component page. I have tried these URI’s with no luck.

I am also accessing home-assistant through nginx reverse ssl proxy.

https://domain.com/api/spotify (domain name I have pointed to home-assistant)
https://192.168.1.222/api/spotify (local ip of raspberry pi running hass)
https://97.44.44.44/api/spotify (wan ip address)

When I clear the site cache/cookies I then see a spotify login screen but it does not work and says incorrect login in but when I revisit it after that then I see the URI error.

Any thoughts or ideas what could cause this? Does the raspberry pi need to be running spotify app? I am hosting it on a headless ubuntu 16.04 server. Thanks.

You should use http://192.168.1.222:8123/api/spotify as the redirect URI. I encountered similar issues to you.

1 Like

I had the same problem as well as others:

Hey I see the same. I’m also using a reverse proxy setting. I don’t think your suggestion to give the local ip address as redirect URI is correct. At least it doesn’t work and it contradicts the official component doc, because that says

The URL is whatever you use to access Home Assistant from outside your network (including port if applicable).

So its specific about using the URL from outside your network. Any other suggestions?

I also tried setting the base_url of the http component but no luck either.

Okay, I take that back. It is all local. To make it work, I added all possible urls I could use to acess HA to the Redirect URIs and removed the setting of the base_url from the http component. Afterwards it worked.