Spotify wont configure :: Invaid redirect URI

Hey Guys,

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?

Cheers,
Basti

I’m also the same

Same here…

Anyone who solved this issue

I got exactly the same redirect uri: Link to OAuth2 Authorize Callback – My Home Assistant

Same, I’ve opened an issue on Github: Spotify integation wrong redirect when importing from yaml · Issue #73113 · home-assistant/core · GitHub

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.

1 Like

More specifically, from the Github thread, adding both urls just like this worked for me:

https://my.home-assistant.io/redirect/oauth
http://homeassistant.local:8123/auth/external/callback

Thanks, WaxBear

2 Likes

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}"
1 Like

Brilliant, that made the trick

nice! Thanks a lot! These are the steps I took (for later reference):

  1. Disable protection mode of the Advanced SSH Haddon
  2. Dive into the HA docker: docker exec -it $(docker ps -f name=homeassistant -q) bash
  3. edit the file: vi /usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py
  4. Go to that line, Press i edit and press escape
  5. `:wq’ to save and quit.
  6. Run integratie Setup
  7. Undo edit
  8. Enable protection mode

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?!

1 Like

@patrick_jane
Users of my SpotifyPlus integration sometimes have the same issue.

Check out my Resolving OAuth Related Errors wiki doc on possible solutions. They should also work for the HA Spotify integration.

Hope it helps!

More Info on SpotifyPlus

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.

Both are easily installed via HACS.

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.

You have to install the SpotifyPlus integration first, and do some basic configuration. Then you have to install the Voice Sentence Templates manually for your language (just copying files to the HA config folder). Currently, templates only exist for English and German.

Check out the SpotifyPlus Voice Assist Intents index - example phrases are listed under each of the intents. Here are a few to get you started …

Play Examples

  • “spotify play artist album Take Everything by artist Seventh Day Slumber”
  • “spotify play artist track I Need You by artist Seventh Day Slumber”
  • “spotify play episode Kurt Russell for podcast Armchair Expert with Dax Shepard”
  • “spotify play favorite tracks for artist Jeremy Camp”
  • “spotify play favorite tracks”
  • “spotify play audiobook The Elfstones of Shannara”
  • “spotify play playlist Old Christian Contemporary”
  • “spotify play podcast Armchair Expert with Dax Shepard”
  • “spotify play podcast Armchair Expert with Dax Shepard latest episode”
  • “spotify play track More Of You”

Player Deck Control Examples

  • “spotify pause”
  • “spotify resume”
  • “spotify next track”
  • “spotify previous track”
  • “spotify restart track”
  • “spotify pause track on player spotify premium”
  • “spotify pause track in the Office”

Favorites Examples

  • “add spotify album favorite”
  • “remove spotify album favorite”
  • “add spotify artist favorite”
  • “remove spotify artist favorite”
  • “add spotify audiobook favorite”
  • “remove spotify audiobook favorite”
  • “add spotify playlist favorite”
  • “remove spotify playlist favorite”
  • “add spotify podcast favorite”
  • “remove spotify podcast favorite”
  • “add spotify podcast episode favorite”
  • “remove spotify podcast episode favorite”
  • “add spotify track favorite”
  • “remove spotify track favorite”
  • “add spotify album favorite on player spotify premium”
  • “add spotify album favorite on spotify premium player”
  • “add spotify album favorite in the Office area”
  • “add spotify album favorite in the Office”

… and more

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.

@patrick_jane
That applies to both the HA Spotify integration as well as the SpotifyPlus integration, as they both use the same OAuth mechanism.