since a few day ive got the error “INVALID_CLIENT: Invalid redirect URI” while trying to setup the Spotify Intergration. I have stored the IP address including port and co as the redirect URI.
But in the practice what the spotify intergration is: “…redirect_uri=https://my.home-assistant.io/redirect/oauth&state=…”
WTF? I have settet the IP Adress and not the Cloud Domain?
What can i do to fix this?
You have to add ‘Link to OAuth2 Authorize Callback – My Home Assistant’ to the redirect URI’s on the application settings page for it to work. Just the http://homeassistant.local:8123/auth/external/callback isn’t sufficient.
Where is this located? Certainly not at the link you posted. Or are you saying you need to put that link in the Spotify Developer’s App or? Please speak as if people do not understand …
Link to OAuth2 Authorize Callback – My Home Assistant seems to be kind of hardcoded.
I somehow hacked /usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py
to always return f"{ha_host}{AUTH_CALLBACK_PATH}" instead of MY_AUTH_CALLBACK_PATH
The proper way would have been to remove “my” from self.hass.config.components but I was not able to find this entry in my docker based 2022.11 config.
Using this hack I was able to authenticate with Home Connect and Neato Oauth2 Providers.
@property
def redirect_uri(self) -> str:
"""Return the redirect uri."""
# if "my" in self.hass.config.components:
# return MY_AUTH_CALLBACK_PATH
if (req := http.current_request.get()) is None:
raise RuntimeError("No current request in context")
if (ha_host := req.headers.get(HEADER_FRONTEND_BASE)) is None:
raise RuntimeError("No header in request")
return f"{ha_host}{AUTH_CALLBACK_PATH}"
Guys, is there any update to this in 2025? I am facing the same issue, and editing files in docker images is pretty much a big no-go as those changes are not permanent.
Home Assistant must provide a way of using a local redirect uri. Why is this not working?!
Check out the SpotifyPlus Integration; it can do everything that the HA Spotify integration can do, supports Spotify Connect enabled devices (Bose, Sonos, Google Chromecast, Amazon Alexa, Denon, JBL, and more), and provides 95+ custom services that can be used in HA automations and scripts. It also has 10 voice assistant intents that allow you to control the player, play content, manage favorites, etc.
There is also a SpotifyPlus Card user-interface that allows you to control the player, manage your Spotify favorites, as well as search the Spotify catalog. You have to install the SpotifyPlus integration first though, and get it configured before you can use the SpotifyPlus Card.
Thanks, but I dont think it helps much. I am not using the HA cloud, as a result I dont have my.home-assistant.io, but this is what my home assistant installation is giving to spotify, and I can’t convince it to do otherwise.
Btw regarding your plugin: can it be controlled via Home assistant voice? Eg „Play XYZ on spotify“ or similar? (Got the voice preview but have yet to set ir up, no clue how it works).
@patrick_jane
I do not use the HA cloud either. The my.home-assistant.io is an internally generated url used by HA, and is only relevant for OAuth callback functions; it is “pointed to” by your Spotify Developer App settings. For example, I use http://homeassistantvm:8123/ for my test HA instance, and http://homeassistant:8123/ for my prod HA instance.
I would suggest that you review the Create Spotify Developer Applications section of the SpotifyPlus wiki docs to ensure you have your settings correct (specifically the redirect URI values). Spotify made some breaking changes to their OAuth processing on 2025/11/27, which might be causing your issue.
Voice Command Support
Yes, voice commands are supported. I do all of my voice stuff using my iPhone and the Voice Assist prompt. The Voice PE also supports these intents, as well as other LLM providers.
Ah okay I see, I thought the my.homeassistant.io was a cloud service, but it isnt. So there is no issue with the authentication anymore. Thanks for the hint. Will try your plugin.