koush / scrypted

Scrypted is a high performance video integration and automation platform
https://scrypted.app
Other
4.32k stars 255 forks source link

Force token on getAbility if the get call fails #1611

Closed apocaliss92 closed 1 month ago

apocaliss92 commented 1 month ago

More recent Reolink devices fail on using some call using the GET endpoint + username/password comination as authentication. This PR extract the api to get the token in a separated token data, to not collide with the other methods, and is used by an alternative getAbility method as documented in the official Reolink API documentation

koush commented 1 month ago

there's too much copy pasting happening here with getAbility, think it can be cleaned up. the parameters contain the token information. im not sure why you need another storage for it.

koush commented 1 month ago

I think what you want is a client mode that only operates with tokens and thus always fetches a token from login. Trying to change the behavior throughout is going to be very messy.

apocaliss92 commented 1 month ago

I think what you want is a client mode that only operates with tokens and thus always fetches a token from login. Trying to change the behavior throughout is going to be very messy.

Yes I didn't want to change to much the current logic, I think I will just fork out this and trying out on my system, thanks for the comments!

koush commented 1 month ago

yeah, I think adding a token mode to the client would be trivial and also non instrusive. existing API calls work work as is. it would simply be changing token usage from fallback to always.