Hi all,
I’ve spent several hours thoroughly debugging the Spotify integration with Home Assistant, and I’m encountering a consistent failure during the OAuth process when using Nabu Casa as the redirect URI.
Here’s what I’ve tested and confirmed:
Working as expected:
- My Nabu Casa remote URL is:
https://uiwedmjoboovqcsplwxz1muo3nptrjpu.ui.nabu.casa
- I created a brand-new Spotify Developer app
- I added this redirect URI (manually typed and verified):
https://uiwedmjoboovqcsplwxz1muo3nptrjpu.ui.nabu.casa/auth/external/callback
- I saved the settings
- I confirmed that the Client ID and redirect URI work with a
curl
test:
bash
CopyEdit
curl -v "https://accounts.spotify.com/authorize?client_id=62f8cf1e38634cf7bf153d8f79b49d4e&response_type=code&redirect_uri=https%3A%2F%2Fuiwedmjoboovqcsplwxz1muo3nptrjpu.ui.nabu.casa%2Fauth%2Fexternal%2Fcallback&scope=user-read-private"
That request results in a 303 redirect to the Spotify login page — no errors.
What’s broken:
When I attempt the integration from the Home Assistant UI (via my Nabu Casa URL), I:
- Get prompted for the Client ID and Secret
- Get redirected to Spotify login
- Enter credentials and complete 2FA
- Then receive:
INVALID_CLIENT: Invalid redirect URI
I’ve tried:
- Clearing
application_credentials
- Deleting and recreating the Spotify app
- Using incognito windows
- Multiple browsers
- Restarting HA and the container
- Verifying the redirect URI matches the base external URL exactly
- Manually testing the full OAuth flow via browser and curl
All results point to the Spotify web-based flow rejecting the redirect at a point where the backend accepts it.
My guess:
- Spotify is incorrectly encoding or validating the redirect URI after login
- Or Nabu Casa subdomains are being flagged by Spotify’s auth layer (not the backend)
Please advise or confirm if there’s a known issue here. Happy to provide logs, packet captures, or test further.
Thank you
—Jeffrey