core: Spotify component will not load new client id and secret

The problem

When loading the integration via the UI (after filling in the credentials in configuration.yaml) it will open the callback to my previously defined local ip. This results in INVALID_CLIENT: Invalid redirect URI and in the URL my local ip is listed, which I believe is to be expected. After creating a new application in the spotify dashboard (with my external accessible URL, proxied by traefik) and updating the credentials in the configuration.yaml, the same error will be given. However, in the URL of the browser, still the previously configured local ip is listed instead of the newly defined external ip.

This leads me to believe that Home Assistant reuses my old Spotify id and secret.

Environment

  • Home Assistant Core release with the issue: 0.110.1, 0.108.9 (updated from 0.97.2)
  • Last working Home Assistant Core release (if known): 0.97.2
  • Operating environment (Home Assistant/Supervised/Docker/venv): Home Assistant
  • Integration causing this issue: Spotify
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/spotify/

Problem-relevant configuration.yaml

homeassistant:
  external_url: !secret external_url
  internal_url: !secret internal_url

[...]

spotify:
  client_id: !secret spotify_clientid
  client_secret: !secret spotify_clientsecret

Traceback/Error logs

Could not find any relevant logs.

Additional information

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (3 by maintainers)

Most upvoted comments

I had a look at the get_url() method of home assistant and noticed that the internal_url always prevails the external_url unless specified as can be seen in PR #35224 . As I didn’t configure the internal URL I would have expected it would go straight for the external URL.

I currently solved it like this:

homeassistant:
  external_url: !secret external_url
  internal_url: !secret external_url

Perhaps my problem was that I had filled in an internal_url before but removed it earlier today?

I am running Homeassistant Core 0.110.4 and I did put the external and internal URLs in the General Configuration section that was implemented in this release of Core. But, the Spotify integration still tries to open the Spotify web page using the internal ip. Perhaps the change from the base_url method to this new method broke the Spotify authorization part of the integration.

Hello good afternoon. I have into the same problem in HA version 0.110.1, after investigating and examining logs and etc, I have noticed in the Spotify Developer dashboard, if you access the application you have a field where you have to add the URIs to perform the process satisfactorily, it has been solved for me and I already have it working I attach a screenshot of where to enter the URIs.

URIs

I hope it helps you!

Cheers

Thanks for the research Peter! When using

homeassistant:
  external_url: !secret external_url
  internal_url: !secret external_url

the spotify link now shows my external_url in the address bar. However, the same error is given: INVALID_CLIENT: Invalid redirect URI, thus for me the problem has not been solved yet.