tavicu / homebridge-samsung-tizen

Homebridge plugin for Samsung TV's with Tizen OS
MIT License
639 stars 86 forks source link

Error 401 - unauthorized #492

Closed Tontonpat closed 2 years ago

Tontonpat commented 2 years ago

Hi, I’ve got « error 401 - unauthorized » when I select Live TV or My Xbox I set the config like this: { "name": "Bedroom TV", "ip": "10.20.30.40", "mac": "A0:B1:C2:D3:E4:F5", "inputs": [ {"type": "input", "name": "Live TV", "value": "digitalTv"}, {"type": "input", "name": "My Xbox", "value": "HDMI1"} ] } Your plugin is up to date. Thanks for your help

tavicu commented 2 years ago

Hi.

Please start the Homebridge in debug mode so we can see more.

But from what you are telling me the error comes from SmartThings API that your request is not authorized. Your api_key and device_id are wrong or when you created the token you didn't give access as you should.

tavicu commented 2 years ago

Also, in the config file you posted doesn't look like you set the device_id. Don't know if you removed it from the message or you don't have it in config also.

https://github.com/tavicu/homebridge-samsung-tizen/wiki/SmartThings-Setup

Tontonpat commented 2 years ago

Thanks for your reply. Here is my full config for your plugin: "platforms": [ { "name": "SamsungTizen", "devices": [ { "api_key": "XX-XX-XX-XX-XX", "device_id": "XX-XX-XX-XX-XX", "name": "Télé", "ip": "192.168.1.X", "mac": "XX:XX:XX:XX:XX:XX", "inputs": [ { "type": "input", "name": "Live TV", "value": "digitalTv" }, { "type": "input", "name": "TV ORANGE", "value": "HDMI1" }, { "type": "input", "name": "Xbox One", "value": "HDMI2" }, { "type": "input", "name": "Nintendo Switch", "value": "HDMI3" }, { "type": "app", "name": "Netflix", "value": "11101200001" }, { "type": "app", "name": "Disney", "value": "3201901017640" }, { "type": "app", "name": "Youtube Kids", "value": "3201611010983" }, { "type": "app", "name": "Plex", "value": "3201512006963" }, { "type": "app", "name": "Youtube", "value": "111299001912" }, { "type": "app", "name": "Prime Video", "value": "3201512006785" }, { "type": "app", "name": "DS Video", "value": "111399002250" } ] } ], "platform": "SamsungTizen" },

and the debug : [3/11/2022, 2:57:04 PM] [Télé] 401 - Unauthorized [3/11/2022, 2:57:04 PM] [Télé] [DEBUG] SmartThingsResponse: 401 - Unauthorized at /homebridge/node_modules/homebridge-samsung-tizen/lib/smartthings.js:105:27 at runMicrotasks (<anonymous>) at processTicksAndRejections (node:internal/process/task_queues:96:5)

tavicu commented 2 years ago

Indeed it's an error message from SmartThings API.

Are you sure the api_key is correct? Because i just tried sending a request with a wrong api_key and i get the 401 - Unauthorized response.

Sending a request with wrong device_id will respond with 403 - Forbidden response.

So at this moment i'm pretty sure your api_key it's incorect

Tontonpat commented 2 years ago

I've just create another api key, and get the device id to be sure. It was an error from the device id. Sorry, it's work flawlessly 👍

tavicu commented 2 years ago

Awesome! Glad it worked out :)