From f4731b116461a87df460bfd8b19f9bd337e82672 Mon Sep 17 00:00:00 2001 From: Ben Foster Date: Mon, 20 Dec 2021 09:30:45 -0500 Subject: [PATCH] Use the documented API method to refresh auth token Fixes #50 --- tuya_iot/openapi.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tuya_iot/openapi.py b/tuya_iot/openapi.py index 493f593..e9f50b5 100644 --- a/tuya_iot/openapi.py +++ b/tuya_iot/openapi.py @@ -15,7 +15,7 @@ TUYA_ERROR_CODE_TOKEN_INVALID = 1010 -TO_C_REFRESH_TOKEN_API_PRE = "/v1.0/iot-03/users/token/" +TO_C_REFRESH_TOKEN_API_PRE = "/v1.0/token/" TO_C_CUSTOM_TOKEN_API = "/v1.0/iot-03/users/login" TO_C_SMART_HOME_TOKEN_API = "/v1.0/iot-01/associated-users/actions/authorized-login" @@ -154,7 +154,7 @@ def __refresh_access_token_if_need(self, path: str): return self.token_info.access_token = "" - response = self.post( + response = self.get( TO_C_REFRESH_TOKEN_API_PRE + self.token_info.refresh_token )