codetheweb / tuyapi

🌧 An easy-to-use API for devices that use Tuya's cloud services. Documentation: https://codetheweb.github.io/tuyapi.
MIT License
2.04k stars 332 forks source link

Permission deny due to cross-region access #550

Open bphermansson opened 2 years ago

bphermansson commented 2 years ago

I try to use tuya-cli to access devices:

DEBUG=* .npm/bin/tuya-cli wizard

But I get this: There was an issue fetching that device. Make sure your account is linked and the ID is correct.

In the debug output: Error: 1106: permission deny ... Error: GET_TOKEN_FAILED 2007, your ip(2.70.69.nnn) cross-region access is not allowed

What to do?

codetheweb commented 2 years ago

Your devices are probably registered in a different region (through the app) than what the API supports.

IIRC there's a way to set your region when signing up, try signing up again with a different region?

bphermansson commented 2 years ago

Seems reasonable, my account in the app has place China and I live in Sweden. I'll try to make a new account for the app, guess I have to reconnect all devices...

useronym commented 2 years ago

I made sure that my region in the app is set to Norway, time zone is also set to Norway, datacentre in Tuya dashboard is set to Central Europe, but I'm still getting this error.

The only thing I can think of is that I don't have the API called IoT Data Analytics as it doesn't seem to exist anymore.

useronym commented 2 years ago

Okay somehow my app got unpaired from the Tuya project. Readded it, made sure I can see my device listed on the website, and now it seems to work. Confusing error message from the API. Thanks for the great work!

jorgnyg commented 2 years ago

Solved this problem by creating a new Smart Life app account in the region "United States of America". Then added the smart device to this account and added the new (USA) account in the "Link Tuya App account" section at Tuya IoT Platform. Also make sure your region at https://myaccount.tuya.com/account is set to USA. This can be changed without creating a new developer account.

Milofow commented 1 year ago

For people like me searching for a solution. For me the solution was changing the endpoint.

See image below:

Scherm­afbeelding 2022-11-11 om 20 57 10