tuya / tuya-iot-python-sdk

Tuya IoT Python SDK for Tuya Open API.
MIT License
130 stars 49 forks source link

Fix refreshing of the credentials in case the refresh token is expired #80

Open azerty9971 opened 3 months ago

azerty9971 commented 3 months ago

If the call to refresh the access token fails because the token is expired then the result of the new connect (which is a new refresh token and a new access token) should be stored in the TuyaTokenInfo that is created in the __refresh_access_token_if_need (line 168).

Without this code, the returned payload is the error one (code 1010) and is thus stored in the TuyaTokenInfo instead of the newly retrieved credentials.