home-assistant/core

Incorrect authorize address for Spotify component

Closed this issue · 8 comments

Home Assistant release (hass --version):
service ver. 1.48

Python release (python3 --version):
Python 3.5.3

Component/platform:
Raspbian
Spotify

Description of problem:
When following the link to authorize Spotify, the link shows up dead:

"INVALID_CLIENT: Invalid redirect URI"

https://accounts.spotify.com/authorize?redirect_uri=https%3A%2F%2Fhomeassistant.lcl%2Fapi%2Fspotify&client_id=c5fc09356068112945ssasda&response_type=code&scope=user-modify-playback-state+user-read-playback-state+user-read-private

Most like this happens due to the lack of port in address? I use a non-default local port for HomeAssistant (not 8123).

Expected:
Link not to be broken.

Problem-relevant configuration.yaml entries and steps to reproduce:

  1. Add Spotify to configuration.yaml
  2. Setup API @ Spotify.com
  3. Follow link "Link Spotify account" from HomeAssistant.

Additional info:

Have you set the Spotify App setting to redirect to the same uri as is in the link ( https://homeassistant.lcl)? Seems to be a settings missmatch.

See the Redirect URI part in https://home-assistant.io/components/media_player.spotify/

Redirect URI in Spotify.com is:

https://homeassistant.lcl:1234/api/spotify

Meaning, it is correct.

I'm having the same issue. If I go to https://{name}.duckdns.org/api/spotify I get a 500 error. If I click the configure link to link my account I get INVALID_CLIENT: Invalid redirect URI. I've added every possible callback URI I can think of in Spotify and I am reasonably active with Spotify development so I'm familiar with the setup on that side.

I am getting this error in my logs. I'm running .69.1. This has worked in the past but has stopped working at some point.

2018-05-18 16:13:29 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/aiohttp/web_protocol.py", line 381, in start
    resp = await self._request_handler(request)
  File "/usr/lib/python3.6/site-packages/aiohttp/web_app.py", line 322, in _handle
    resp = await handler(request)
  File "/usr/lib/python3.6/site-packages/aiohttp/web_middlewares.py", line 88, in impl
    return await handler(request)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/http/static.py", line 68, in staticresource_middleware
    return await handler(request)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/http/real_ip.py", line 27, in real_ip_middleware
    return await handler(request)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/http/ban.py", line 68, in ban_middleware
    return await handler(request)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/http/auth.py", line 28, in auth_middleware
    return await handler(request)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/http/view.py", line 101, in handle
    result = handler(request, **request.match_info)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/media_player/spotify.py", line 115, in get
    self.oauth.get_access_token(request.query['code'])
  File "multidict\_multidict.pyx", line 140, in multidict._multidict._Base.__getitem__
  File "multidict\_multidict.pyx", line 135, in multidict._multidict._Base._getone
KeyError: "Key not found: 'code'"

Same issue as jayheavner

I see the same thing with the latest code, on Docker

Any updates on this? I have the same issue, also running on docker

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍

This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem 👍