sensor.trakt icon indicating copy to clipboard operation
sensor.trakt copied to clipboard

Wrong redirect URL

Open holantomas opened this issue 2 years ago • 3 comments

Version of Home Assistant

Home Assistant 2022.10.3

Version of the custom_component

2.0.4

Configuration

None. Over gui

Describe the bug

It's easy. I don't use HA Cloud but have public, static IP with domain. So I setup Trakt app with redirect_uri to https://my_domain_censored/auth/external/callback but if I try to add integration to HA it will redirect me to trakt page with error The requested redirect uri is malformed or doesn't match client redirect URI.. So I check request URL and there's wrong redirect_uri parameter. Instead of what I configured in Trakt app, HA sending:

https://api-v2launch.trakt.tv/oauth/authorize?response_type=code&client_id=CENSORED&redirect_uri=https://my.home-assistant.io/redirect/oauth&state=CENSORED

As you can see the redirect_uri param is send as https://my.home-assistant.io/... what is URL to Nabu Casa I guess. I don't find way to force integration to send actual URL.

And yes I tried Nabu Casa cause of Google Assistant, there can be problem, but now I'm logged of the cloud and don't know if HA keep this URL.

holantomas avatar Oct 14 '22 10:10 holantomas

The fix for this is to change your redirect url when setting up the API integration to: https://my.home-assistant.io/redirect/oauth

use-the-fork avatar Oct 16 '22 15:10 use-the-fork

@use-the-fork

OK but the doc is wrong

Use the following redirect_uri:
With HA cloud configured: https://<cloud-remote-url>/auth/external/callback
Without HA cloud configured: http://<local-ip>:/auth/external/callback

holantomas avatar Oct 16 '22 16:10 holantomas

Indeed,

  1. the docs are wrong
  2. the trick using https://my.home-assistant.io/redirect/oauth is working

Due to the recent database maintenance of Trakt.tv, possibly more users need to reauthenticate in the next days and will likely run into this issue too.

bcutter avatar Dec 23 '22 02:12 bcutter