Skip to content
This repository has been archived by the owner on Dec 21, 2021. It is now read-only.

I need help #9

Open
HaydenRichardson opened this issue Mar 29, 2021 · 10 comments
Open

I need help #9

HaydenRichardson opened this issue Mar 29, 2021 · 10 comments

Comments

@HaydenRichardson
Copy link

Can someone help me with the setup.

@codetheweb
Copy link
Member

Please include more details about where you're getting stuck.

@HaydenRichardson
Copy link
Author

HaydenRichardson commented Mar 29, 2021

@codetheweb ok so
const OpenAPI = require('@tuyapi/openapi');

const api = new OpenAPI({key: '10101010', secret: '1010101010', schema: '10101010'});

(async () => {
// Must be called before any other operations to get auth token
await api.getToken();

const uid = await api.putUser({
countryCode: '1',
username: 'my-username',
password: 'c7fb2740c5fc45660d9e4ed765a479fa',
usernameType: 1});

console.log(uid);

const token = await api.getDeviceToken({uid, timezone: 'America/Chicago'});

console.log(token);

console.log(await api.getDevicesByToken('EkjQjlbo'));
})();
i have all of this and i get this error UnhandledPromiseRejectionWarning: Error: sign invalid
at OpenAPI._client.got_1.default.extend.hooks.afterResponse (/root/ping-pong-bot/my-bot/node_modules/@tuyapi/openapi/dist/api.js:74:31) also i was wondering if you had a discord?

@HaydenRichardson
Copy link
Author

actually this is my code
const OpenAPI = require('@tuyapi/openapi');
const api = new OpenAPI({key: '', secret: '************', schema: 'sjmnsjdkag09kd08zf9m'});

(async () => {
// Must be called before any other operations to get auth token
await api.getToken();

const uid = await api.putUser({
countryCode: '1',
username: '[email protected]',
password: '*********',
usernameType: 1});

console.log(uid);

const token = await api.getDeviceToken({uid, timezone: 'America/New-York'});

console.log(token);

console.log(await api.getDevicesByToken('EkjQjlbo'));
})();

@codetheweb
Copy link
Member

If you're getting sign invalid either your key or secret is probably wrong. Please double-check those values.

@HaydenRichardson
Copy link
Author

is that how i would do the timezone?

@HaydenRichardson
Copy link
Author

@codetheweb Do i put the devices id or the projects id for schema?

@HaydenRichardson
Copy link
Author

I need to start asking these questions in one comment but for username and password i use the email and password for https://iot.tuya.com/.

@HaydenRichardson
Copy link
Author

@codetheweb i think i fixed that error but now its telling me permission denied.

@codetheweb
Copy link
Member

You should use the user account you sign into the app with for credentials here instead of the credentials used to sign into iot.tuya.com.

@HaydenRichardson
Copy link
Author

o ok

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

No branches or pull requests

2 participants