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.

7 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

I didnā€™t use default_config_disabler. Actually, I couldnā€™t find it in HACS, perhaps because Iā€™m using the HA docker version?

I was resetting the integration after some time, and I forgot that I had to setup it on the spotify dashboard for developers. So to solve the INVALID_CLIENT: Invalid redirect URI error, the full steps for me were:

  1. Go to Spotify for Developers / Dashboard
  2. Create app or click on your already existing HA app then ā€œSettingsā€
  3. Click on ā€œSettingsā€
  4. Add https://<your-HA-address>/auth/external/callback and https://my.home-assistant.io/redirect/oauth to ā€œRedirect URIsā€. Your HA address can be something like myownhass.duckdns.org, or homeassistant.local:8123. Save and close
  5. Go to my.home-assistant.io and save your HA address.
  6. Add Spotify integration into HA and open the redirection link.
2 Likes

This worked for me - if the next step fails ā€œLink to HAā€, if your HA is hosted on another device, change the URL to that of the device and not .local