tuya / tuya-iot-python-sdk

Tuya IoT Python SDK for Tuya Open API.
MIT License
125 stars 48 forks source link

Token is never refreshed #35

Open umonaca opened 2 years ago

umonaca commented 2 years ago

https://github.com/tuya/tuya-iot-python-sdk/blob/83f1e999d75ef87b2170ffbbb239ca8651dab0c3/tuya_iot/openapi.py#L144

But is_connect() never check if the token is expired.

Besides, this bug needs more than a one-line fix. You have another hidden problem in your code:

__request() => __refresh_access_token_if_need() => post() => __request() => __refresh_access_token_if_need()

Currently the loop breaks because of is_connect() == True. However, you should be aware that once you fix the bug mentioned above, you must also check whether path.startswith(TO_C_REFRESH_TOKEN_API).

aambroze commented 1 year ago

Any update on that ?

awm1 commented 1 year ago

Any update on that ?

No, there are several pull requests that would solve this issue, however, any of developers won't even reject them.