dylandoamaral / trakt-integration

A Trakt integration for Home Assistant compatible with upcoming media card
MIT License
30 stars 12 forks source link

OAUTH not working #31

Closed nicosaurus closed 1 year ago

nicosaurus commented 2 years ago

I followed the instructions and used by HA cloud url in the correct place during step 4, but I receive an AUTH error when attempting to add the home assistant integration. TRAKT OAUTH ERROR The requested redirect uri is malformed or doesn't match client redirect URI.

dylandoamaral commented 2 years ago

I will see if I can reproduce this error

dylandoamaral commented 2 years ago

I am sorry, I can't reproduce the error. In Trakt, in your api app, you are sure that your redirect URI is something like http://localhost:8123/auth/external/callback ?

nicosaurus commented 2 years ago

Unfortunately it still doesn't work. I retested with every different combo for the URI. I tested with my nabu casa link, with and without the port, with my internal ip, with and without the port, and as http://homeassistant, with and without the port. I also tested as http and https. I tried them in an incognito tab and on a different browser too. All of these returned the OAUTH error. I also retested today with the most current version of the component and current version of home assistant. No luck. If it matters, I used to have the sensors.trakt component installed and connected, but removed it after finding this one.

dylandoamaral commented 2 years ago

The steps should be the same as the other trakt integration. I can't reproduce the error, so I can't resolve it for now. If you had success with the other integration then you can just use it instead. I let this issue open in case someone else has the same issue. If you fix the issue, don't hesitate to close the PR.

kerryandjane commented 2 years ago

Not working for me. I've tried many many variations of the uri and nothing.

http://192.168.1.100:8123/auth/external/callback

no luck.

kerryandjane commented 2 years ago

Anything else we could try?

I did a fresh install of Homeassistant, Fresh Trakt useraccount, fresh API followed all steps. (using without cloud redirect_uri) Same result.

I'm using HA in a docker container.

dylandoamaral commented 2 years ago

I have to find the reason why you can't use the addon, it is still difficult since I can't reproduce it. Do you have some screens of the error ?

blizzrdof77 commented 2 years ago

I have to find the reason why you can't use the addon, it is still difficult since I can't reproduce it. Do you have some screens of the error ?

Hopefully this helps! 😬

GIF Screen Recording GitHub Trakt HASS Integration (compressed)

Trakt OAuth Error Screenshot image

dylandoamaral commented 2 years ago

Thanks, can you give me the redirect URI on https://trakt.tv/oauth/applications/ to be sure that it is OK ?

blizzrdof77 commented 2 years ago

Good call.

The redirect URL just needed updated to use: https://my.home-assistant.io/redirect/oauth

I would suggest adding this to the documentation and/or integration setup process. Then I would consider this resolved.

Thanks!

robloh commented 2 years ago

I had this same issue, until I realized it was redirecting through "my home assistant". Here's what I had to do to fix this:

  1. go to https://my.home-assistant.io/ and enter the correct path to my instance (for me this was http://172.30.1.11:8123/)
  2. instead of entering my local address (http://172.30.1.11:8123/) in the TRAKT application page I entered this: https://my.home-assistant.io/redirect/oauth
  3. added the integration
  4. accepted in TRAKT
  5. then accepted in the my home assistant page that showed up
  6. profit

I wonder if @dylandoamaral does not have the (default) "my" integration enabled? See: https://www.home-assistant.io/integrations/my/

kerryandjane commented 2 years ago

I had this same issue, until I realized it was redirecting through "my home assistant". Here's what I had to do to fix this:

  1. go to https://my.home-assistant.io/ and enter the correct path to my instance (for me this was http://172.30.1.11:8123/)
  2. instead of entering my local address (http://172.30.1.11:8123/) in the TRAKT application page I entered this: https://my.home-assistant.io/redirect/oauth
  3. added the integration
  4. accepted in TRAKT
  5. then accepted in the my home assistant page that showed up
  6. profit

I wonder if @dylandoamaral does not have the (default) "my" integration enabled? See: https://www.home-assistant.io/integrations/my/

Flawless! This works.... adding https://my.home-assistant.io/redirect/oauth as the redirect I don't understand it but it works. Thank you.

dylandoamaral commented 2 years ago

I had this same issue, until I realized it was redirecting through "my home assistant". Here's what I had to do to fix this:

  1. go to https://my.home-assistant.io/ and enter the correct path to my instance (for me this was http://172.30.1.11:8123/)
  2. instead of entering my local address (http://172.30.1.11:8123/) in the TRAKT application page I entered this: https://my.home-assistant.io/redirect/oauth
  3. added the integration
  4. accepted in TRAKT
  5. then accepted in the my home assistant page that showed up
  6. profit

I wonder if @dylandoamaral does not have the (default) "my" integration enabled? See: https://www.home-assistant.io/integrations/my/

Thank you for your workaround, I let the issue open to see if someone else has this problem even with your workaround. I will then add it to the README.

I don't think I have the "my" integration in both my development environment and my production one but maybe I am missing something. However in my production one I have a DNS routing maybe that's why it is working.

robloh commented 2 years ago

Thank you for your workaround, I let the issue open to see if someone else has this problem even with your workaround. I will then add it to the README.

I don't think I have the "my" integration in both my development environment and my production one but maybe I am missing something. However in my production one I have a DNS routing maybe that's why it is working.

I don't think my solution is really a workaround, because most installations (and definitely the new ones) will have the "my" integration enabled (https://analytics.home-assistant.io/#integrations shows it's enabled for 97.8% of installations that allow statistics to be collected).

Maybe you could test it out yourself with the "my" integration added @dylandoamaral ?

dylandoamaral commented 2 years ago

It won't help since it actually works without it. I need to know if it fix the problem for people having this issue.

nicosaurus commented 2 years ago

Thank you @robloh using https://my.home-assistant.io/ worked. I had never set this up before, but following your steps and using my local ip worked.

@dylandoamaral this solution resolved the issue for me.

Scales82 commented 1 year ago

YES THIS WORKS. I had same issue as the others.

It won't help since it actually works without it. I need to know if it fix the problem for people having this issue.

jpconfessor commented 1 year ago

Thanks! The workaround works :) I was really close to trying this.. since the oauth2 error was complaining about the client url not matching the redirected one... of course it won't match! Kudos to you Rob!

dylandoamaral commented 1 year ago

I think I have enough reason to put this workaround in the readme, thank you guys !