thlucas1 / homeassistantcomponent_spotifyplus

Home Assistant integration for Spotify Player control, services, and soundtouchplus integration support.
MIT License
54 stars 4 forks source link

OAuth request failed #40

Closed sulliwane closed 2 months ago

sulliwane commented 2 months ago

System Health details

System Information

version core-2024.8.1
installation_type Home Assistant Supervised
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.12.4
os_name Linux
os_version 5.15.35-rockchip64
arch aarch64
config_dir /config
Home Assistant Community Store GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 5000 Installed Version | 1.34.0 Stage | running Available Repositories | 1386 Downloaded Repositories | 14
AccuWeather can_reach_server | pending -- | -- remaining_requests | 20
Home Assistant Cloud logged_in | false -- | -- can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Home Assistant Supervisor host_os | Debian GNU/Linux 11 (bullseye) -- | -- update_channel | stable supervisor_version | supervisor-2024.08.0 agent_version | 1.5.1 docker_version | 24.0.2 disk_total | 28.4 GB disk_used | 14.4 GB healthy | true supported | true host_connectivity | true supervisor_connectivity | true ntp_synchronized | true virtualization | supervisor_api | ok version_api | ok installed_addons | Samba share (12.3.2), Mosquitto broker (6.4.1), Duck DNS (1.18.0), File editor (5.8.0), Node-RED (18.0.5), Zigbee2MQTT (1.39.1-1), eufy-security-ws (1.8.0-2), Frigate (0.14.0)
Dashboards dashboards | 3 -- | -- resources | 5 views | 9 mode | storage
Recorder oldest_recorder_run | August 13, 2024 at 07:25 -- | -- current_recorder_run | August 13, 2024 at 09:25 estimated_db_size | 135.84 MiB database_engine | sqlite database_version | 3.45.3
Xiaomi Miot Auto component_version | 0.7.7 -- | -- can_reach_server | ok can_reach_spec | ok logged_accounts | 0 total_devices | 0

Checklist

Describe the issue

Describe the bug When adding my credentials, it fails with below error message:

Screenshots Screenshot from 2024-08-13 09-51-28

Environment details:

Output of HA logs Screenshot from 2024-08-13 09-50-41 Screenshot from 2024-08-13 09-50-31

But the authorization code is valid. Just tried creating a new one: image

Same error: OAuth request failed while processing SpotifyPlus OAuth Application Credentials; please check the System Log for further information

Thanks for the help!

thlucas1 commented 2 months ago

To be honest, I have not seen this error before.

The first thing I would do after the HA reboot would be to clear your browser cache. With the way HA cache's web-pages, it could simply be a caching issue (not likely, but want to rule it out).

It could also be a temporary issue related to the Spotify web authorization server. It's rare, but it does happen.

With that said, can you confirm the following for me:

Questions:

1) is this the first OAuth Application Credentials that you have defined? Or have you configured the stock HA Spotify integration successfully? 2) what browser are you using to configure the integration? e.g. "Chrome from Desktop", "Safari on my iPad", etc. 3) any System Log entries related to spotifyplus or spotifywebapipython?

Please let me know. Thanks

sulliwane commented 2 months ago

Restarted HA, then tried to setup Spotifyplus in a new chrome browser session and bam, it worked!

Thanks a lot for your very thorough reply and the time, much appreciated :+1:

sulliwane commented 2 months ago

Well I spoke too quick.

I updated HA to 2024.8.2 and restarted HA. I noticed SpotifyPlus was again like this: Screenshot from 2024-08-19 17-31-14

And going through the Oauth setup one more time (in a private browser window) lead to the same error: Screenshot from 2024-08-19 17-31-05 Logs show this: image

So reopening the issue....kek

thlucas1 commented 2 months ago

In the try before (when it worked), were you able to authorize the access via Spotify? e.g. it should have prompted you to login with your Spotify credentials (unless they were cached), and then it should have prompted you to authorize the access by clicking on "I Agree" or "I Approve", something like that.

The fact that it worked before should have completed setup and authorized the credentials.

I would reboot HA, completely clear the cache (including cookies), and then try the SpotifyPlus setup again.

sulliwane commented 2 months ago

So I updated to the latest version of the component and following that, now I've already rebooted 3 times HA and each time Spotifyplus is correctly recognized 👍

I'm not 100% sure it's linked to the latest version tho...but so far so good!

thlucas1 commented 2 months ago

You can verify the version installed by going to Settings \ Devices and Services \ SpotifyPlus (e.g. http://homeassistant.local:8123/config/integrations/integration/spotifyplus) and checking the version info that is displayed just under the Spotify logo: image

I still believe the issue here is due to the way Home Assistant cache's pages in the browser. A reboot and clearing of cache tends to fix a lot of things in HA. lol

Glad it is working for you.