Spotify error INVALID_CLIENT: Invalid redirect URI

Hello guys

after installing the latest version 2022.6 my spotify stop work. So i tried to remove it and reinstall it.

When i try to connect my HA with my Spotify i get the error: INVALID_CLIENT: Invalid redirect URI

My Spotify setup is the same with the correct redirect address:

But the strange think is thet the redirect address in HA has a completly different address:

The client id in the URL is the correct one but for redirect url it gets the parameter: redirect_uri=https://my.home-assistant.io/redirect/oauth WHICH IS NOT CORRECT AND I NEVER PUT ANYWHERE THIS URL

Note that i delete and recreate the app in developer Spotify with the exact same error

Any idea what is wrong here??

It happens to me exactly the same

Same error, and when I change the URI, I’m redirected to homeassistant page with “Error” message

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.

1 Like

I dont understand the accepted answer, but the URL that you need to put into the application as far as I understand is:

Link to OAuth2 Authorize Callback – My Home Assistant and not the URL for the local instance like it used to be

1 Like

Did you get this fixed? As I’ve followed the steps and still doesn’t work

I’ve also submitted a few messages on this. I’ve followed the advice but it doesn’t work for me either.

1 Like

In case this needs additional clarification, looks like two URLs need to be added to the Spotify developer portal.

6 Likes

Thanks. I can confirm adding the two URLs:
http://homeassistant.local:8123/auth/external/callback

Instantly fixed the error and I was able to complete adding the integration.

This is the solution, not the one marked

Your explanations seem clear.
It seems so simple but in the end, I’m still confused.

I pasted the 2 URLs as is. I still have the same error. (with or without port :8123) it the same issue for me…

INVALID_CLIENT: Invalid redirect URI

The url that appears in the address of the error page is:

Did you need to change anything in configuration.yaml or home assistant?

1 Like

When the error screen comes up, look in the address bar for the redirect uri. Copy that address into your Spotify developer account instead of the http://homeassistant.local/auth/external/callback. The /auth/external/callback should be the same, but your address may vary based on your setup. Mine is https and uses my dynamic dns address instead of a local address. With that and the generic oauth redirect uri in there mine started working again.

Hey Guys. Almost don’t dare to ask, because the whole thing seems so well explained and documented. But I just can’t get past that INVALID_CLIENT: Invalid client problem. Here is what I currently have set up, according to this thread:

Spotify Dev:
Redirect URIs:
started with just one entry: Link to OAuth2 Authorize Callback – My Home Assistant
then came to this thread and as a result, added another entry, so it looks like this:

http://homeassistant.local:8123/auth/external/callback

over on my home assistant instance I have:

Next, over on HA, I add the spotify integration. press add integration, entery spotify and when it shows up, I click on it. A new browser tab opens with the dreaded invalid_client error.

What else do I have to do?

Also, the tab that opens with the error, if I copy paste it’s url address and look for the redirect url, its:

&redirect_uri=https://my.home-assistant.io/redirect/oauth&state

So it fits the one address I have in the spotify application.
(havent used the client secret anywhere so far, I guess that’s for later)

can somebody help?


Edit: I just fooled around more with the url I get on the error tab.
client_id= has my spotify email. So I deleted that and used the client id from the spotify application.

When I use that, I get to the next page for the first time, asking me if I want to link it to my home assistant account. Upon chosing link account, I get to a new error page:

Page Not Found

Looks like you’ve followed a broken link or entered a URL that doesn’t exist on this site.

2 Likes

For any poor soul that ends up here, the problem is as follows.

If you have default_config: present in your configuration.yaml, it will automatically enable the my plugin which forces the redirect url to use my.home-assistant.io

To disable this you need to either:

  1. Remove default_config: (but this means you have to manually set up EVERY other feature it includes)
  2. [RECOMMENDED] Add default_config_disabler (here) via HACS and use it to disable the my plugin.
4 Likes

The spotify integartion does not work. after clean first install the redirect to an invalid page:
INVALID_CLIENT: Invalid redirect URI

Would it be an improvement to change the flow for install by creating a step where the spotify account id with secret key can be filled in?

Bump?
Is there somebody who is able to do a clean install without issues?

@Jawiweb
This worked for me:

  1. Add this to the redirect URIs in the Spotify API settings of HASSIO
http://homeassistant.local:8123/auth/external/callback

Source:

Great information. This fixed it. I was trying to make this work on friends HA install, where they did not expose HA to the internet and did not have a subscription. Nothing worked until i added the default_config_disabler and then told it to disable the my space. Then i went back to the spotify integration and it worked immediately.

THANK YOU!! :slight_smile:

1 Like