tuya / tuya-connector-nodejs

nodejs sdk
38 stars 17 forks source link

Permission Deny error #13

Open mjpoo opened 1 year ago

mjpoo commented 1 year ago

When I try to connect to the Central Europe server to get the device as per the "getting started" code I get a 1106 permission deny error. The gateway device that I am trying to connect to has "Read, write, and Manage" permissions.

import { TuyaContext  } from '@tuya/tuya-connector-nodejs';

const tuya = new TuyaContext({
  baseUrl: 'https://openapi.tuyaeu.com',
  accessKey: process.env['ACCESSID'],
  secretKey: process.env['ACCESSSECRET'],
});

export const getDevice = async () => {
    const device = await tuya.device.detail({
      device_id: process.env['DEVICEID']
    });
}
mjpoo commented 1 year ago

After some digging in the node_module I think this is caused by /iot-o3 being included in the EU (and other locales?) paths.

nostalgie commented 1 year ago

Same problem. Solution for me - call API via context.request

Really, no one nodejs library for Tuya not working as described.

magisystem0408 commented 1 month ago

same problem. not working raise permission error


> tuya_sdk_test@1.0.0 dev
> ts-node main.ts

{
  code: 1106,
  msg: 'permission deny',
  success: false,
  t: 1717465595107,
  tid: '46xxxxxxxx'
}
magisystem0408 commented 1 month ago

@funnybunnyQAQ

also offical postman request sample is not working.

https://developer.tuya.com/en/docs/iot/set-up-postman-environment?id=Ka7o385w1svns

Evenshen1202 commented 1 month ago

same problem. not working raise permission error

> tuya_sdk_test@1.0.0 dev
> ts-node main.ts

{
  code: 1106,
  msg: 'permission deny',
  success: false,
  t: 1717465595107,
  tid: '46xxxxxxxx'
}

Data centers have rules, and they belong to the data center according to the user's country code. For specific country codes corresponding to data centers, please refer to: https://developer.tuya.com/en/docs/iot/oem-app-data-center-distributed?id=Kafi0ku9l07qb

Japan belongs to the US West data center, please modify it to: baseUrl: 'https://openapi.tuyaus.com', If you have any other questions, please get Tech support on the IoT platform:https://service.console.tuya.com/8/3/list?source=support_center