Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to authenticate after upgrade #35

Open
edwolfe3 opened this issue Dec 14, 2020 · 1 comment
Open

Unable to authenticate after upgrade #35

edwolfe3 opened this issue Dec 14, 2020 · 1 comment

Comments

@edwolfe3
Copy link

I updated (actually removed and installed) to version 2.3.5 of njstuya and 1.07 of cloudtuya and now I'm getting the following using the same user-id and password. Before upgrading I was just getting the can't auth twice in 60 seconds error. FYI: it would be nice if an upgrade preserved the old key.json file so that it would not need to be recreated.

 njstuya booting njstuya +0ms
  njstuya "{argName} value is: 06200045dc4f2236e565_2 +4ms
  njstuya "{argName} value is: cloud +1ms
  njstuya api {"Instructions":"Complete with tuya/smart_life app email/pass/dialingCode/region then rename to key.json","userName":"[hidden]","password":"[hidden]","countryCode":"44","bizType":"smart_life","region":"EU"} or [hidden] +4ms
  njstuya Error: ENOENT: no such file or directory, open './cloudToken.json'
  njstuya     at Object.openSync (fs.js:462:3)
  njstuya     at Object.readFileSync (fs.js:364:35)
  njstuya     at runCloud (/etc/openhab2/scripts/node_modules/njstuya/njstuya.js:205:28)
  njstuya     at main (/etc/openhab2/scripts/node_modules/njstuya/njstuya.js:387:34)
  njstuya     at Object.<anonymous> (/etc/openhab2/scripts/node_modules/njstuya/njstuya.js:390:1)
  njstuya     at Module._compile (internal/modules/cjs/loader.js:999:30)
  njstuya     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
  njstuya     at Module.load (internal/modules/cjs/loader.js:863:32)
  njstuya     at Function.Module._load (internal/modules/cjs/loader.js:708:14)
  njstuya     at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12) +2ms
  cloudtuya {"responseStatus":"error","errorMsg":"Get accesstoken failed. Username or password error!"} +0ms
  cloudtuya {
  cloudtuya   responseStatus: 'error',
  cloudtuya   errorMsg: 'Get accesstoken failed. Username or password error!'
  cloudtuya } +1ms
Get accesstoken failed. Username or password error!
(node:8356) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'expires_in' of null
    at runCloud (/etc/openhab2/scripts/node_modules/njstuya/njstuya.js:212:43)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:8356) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:8356) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
@unparagoned
Copy link
Owner

You are correct and it was annoying me as well. Anyway, you can now store the key.json file in the parent directory of the node_modules folder. That way it won't get deleted by npm.

So store it in the folder "scripts" if njsTuya is in scripts/node_modules/njsTuya/

I'm leaving this open until the documentation is updated to reflect the change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants