0.115 Media Player - Spotify won't re-authenticate/reconfigure

0.115 upgrade worked without a hitch.
I am being asked to go to Integrations and to “Reconfigure” the Spotify integration.
When I click on the red button it says “Open Website” which I do.
New browser tab opens but with this error message “INVALID_CLIENT: Invalid redirect URI”
Not sure where to go from here?

1 Like

I have the same problem but I have Spotify already in integrations and it’s working fine.

So do I and it was working just fine.
I checked everything I now from a SPotify setup point of view.
No Luck!

Here’s what I did to correct this:

  • Try the integration again, but on the page you get the “INVALID_CLIENT” error, take a look at the URL
  • In the URL, copy this section: http[s]://[YOUR URL]:8123/auth/external/callback (my instance uses https because I’m using duckdns and encrypt this.
  • Go to https://developer.spotify.com and go to your dashboard
  • Look for your Spotify Client ID section, click “Edit Settings”
  • Under “Redirect URIs”, paste the URL that you copied from the error page, click “add” then click “Save.”
  • Try the integration again

Hope this works for ya!

6 Likes

Thanks a lot. You bring me a step closer to the solution. After your workarround, i can accept the accsees (on the spotify page) for home assistant. But after this step, the webbrowser shows a error: website is not available (ERR_CONNECTION_REFUSED)

The url during with this error look like that: https://xxxxxxxx.duckdns.org/auth/external/callback?code=AQCExxxxxxxxxxxxxx

Do you have any idea?

That did it, works!
I am using Nabucasa so that section of the url was directing through that service.
Now all I got to figure out is how to get that media player card to enable me to direct the music to the device I want to.
Thanks for the help!

In my setup is working if you do the reauthentication from the external URL and not from your local one. It makes sense, since the local address is not reachable from outside the LAN.

I was able to solve my problem.
I’m usually logged in to the Home Assistant with https://xxxxxx.duckdns.org:8123. In order to successfully implement the integration, I had to log in with my internal IP: https: //192.168.xxx.xx:8123
There was a security notice of the browser https without certificate, which must be skipped. Then it worked.

Here in a few steps:

  1. go to https://developer.spotify.com and to the dashboard
  2. look for your Spotify Client ID section and click “Edit Settings”
  3. Under “Redirect URIs”, paste the URL https://192.168.xxx.xx:8123/auth/external/callback , click “add” and “save.”
  4. log in to your Homeassistant with your local IP (URL: https://192.168.xxx.xx:8123) and dont use the external url (like https://xxxxx.duckdns.org:8123)
    If you use https, you have to skip the security notice of the browser (https without certificate)
  5. try the Spotify integration again
3 Likes

Also bumping into some strangeness with the Spotify integration:

Every reboot since 0.115.2 (coming from 0.114.3) I get the notification I need to reauth Spotify. When I go to the integrations page, I hit Reconfige on the spotify integration and after hitting submit I am presented with a dialog box containing only “Aborted”.

Strangely enough, I don’t really need to reauth because the spotify integration still works (showing playing songs etc).

Next to that, the media browser shows Spotify in the dropdown for Select Media Player, but then gives me a red msg " Integration does not support browsing media "

And in the logs:

Logger: homeassistant.components.media_player
Source: components/media_player/init.py:991
Integration: Media Player (documentation, issues)
First occurred: 19:40:34 (4 occurrences)
Last logged: 19:46:12

media_player.spotify_snip allows media browsing but its integration (spotify) does not

Any ideas?

Edit:

Screenshots:

To answer my own question in case anyone else bumps into this.

I had to reauth in HA using the external IP address, e.g. my phone on 4G instead of wifi). Then everything started working as expected again.

Hello,

i have a problem with the new browsing media feature for the spotify integration.
If i configure the spotify integration all works fine.
After some time i get the message " Integration does not support browsing media".
I dont get any message to re-authenticate or sometihing, still the media browser is not working.
If i delete the spotify integration an add the same again, the spotify media browser is working normally.

Anyone some ideas to solve this?

I have Home Assistant 0.115.2 running in docker on a synology 918+

thanks a lot

Anything in the logs regarding Spotify?

Hello Skye,

i have the same log entry like you mentioned before and i also have this log additionally:

Logger: homeassistant.helpers.entity
Source: components/spotify/media_player.py:462
First occurred: 5:23:55 (2 occurrences)
Last logged: 6:57:55

Update for media_player.spotify_xxx fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 670, in urlopen
    httplib_response = self._make_request(
  File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 426, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 421, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/lib/python3.8/http/client.py", line 1347, in getresponse
    response.begin()
  File "/usr/local/lib/python3.8/http/client.py", line 307, in begin
    version, status, reason = self._read_status()
  File "/usr/local/lib/python3.8/http/client.py", line 268, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/local/lib/python3.8/socket.py", line 669, in readinto
    return self._sock.recv_into(b)
  File "/usr/local/lib/python3.8/ssl.py", line 1241, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/local/lib/python3.8/ssl.py", line 1099, in read
    return self._sslobj.read(len, buffer)
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 726, in urlopen
    retries = retries.increment(
  File "/usr/local/lib/python3.8/site-packages/urllib3/util/retry.py", line 403, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/usr/local/lib/python3.8/site-packages/urllib3/packages/six.py", line 734, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 670, in urlopen
    httplib_response = self._make_request(
  File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 426, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 421, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/lib/python3.8/http/client.py", line 1347, in getresponse
    response.begin()
  File "/usr/local/lib/python3.8/http/client.py", line 307, in begin
    version, status, reason = self._read_status()
  File "/usr/local/lib/python3.8/http/client.py", line 268, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/local/lib/python3.8/socket.py", line 669, in readinto
    return self._sock.recv_into(b)
  File "/usr/local/lib/python3.8/ssl.py", line 1241, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/local/lib/python3.8/ssl.py", line 1099, in read
    return self._sslobj.read(len, buffer)
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 471, in async_device_update
    await self.hass.async_add_executor_job(self.update)  # type: ignore
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/spotify/media_player.py", line 195, in wrapper
    result = func(self, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/components/spotify/media_player.py", line 462, in update
    current = self._spotify.current_playback()
  File "/usr/local/lib/python3.8/site-packages/spotipy/client.py", line 1635, in current_playback
    return self._get("me/player", market=market, additional_types=additional_types)
  File "/usr/local/lib/python3.8/site-packages/spotipy/client.py", line 284, in _get
    return self._internal_call("GET", url, payload, kwargs)
  File "/usr/local/lib/python3.8/site-packages/spotipy/client.py", line 239, in _internal_call
    response = self._session.request(
  File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 643, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 498, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

As mentioned before i dont have the button to reconfigure. If i just delete the spotify integration and add it again all works fine.
Just now it works fine but i think its just a question of time until it shows me the “integration does not support browsing media” message again.

thanks

Weird, not sure what the cause of that could be, sorry :frowning:

I’ve got the same problems - every time I restart HA it says I need to re-authenticate spotify but comes up withe the aborted screen but other than that it works - I’ve tried resetting the secret in spotify but doesn’t work - you say you had to reauthenticate to HA externally - but if your HA instance isn’t exposed to the internet? Any ideas?