I need to get an access token so I check the Tuya
// API URL
$api_url = "https://openapi.tuyaeu.com/v1.0/token?grant_type=1";
$timestamp = round(microtime(true) * 1000);
$headers = [
"grant_type: 1",
"client_id: xwnaaaaaaaaaaaaarae8y",
"secret: 0dfaaaaaaaaaaaaaaaaaaa37872d",
"t: $timestamp",
];
$ch = curl_init($api_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo "cURL Error: " . curl_error($ch);
} else {
echo "Response: " . $response;
}
curl_close($ch);
?>
then I got the error: Response: {“code”:1004,”msg”:”sign invalid”,”success”:false,”t”:1733675216618,”tid”:”3ded2504b58111ef828e8aa4893defa6″}
Does anybody have experience with tuya API and how to get access token?
1