Skip to content

Commit

Permalink
Revert device-registration.ts
Browse files Browse the repository at this point in the history
Revert to a62bc6c
  • Loading branch information
storycraft authored Nov 9, 2021
1 parent 265fe64 commit dd8cbae
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions examples/device-registration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@ const DEVICE_NAME = process.env['deviceName'] as string;
async function main() {
const form = {
email: EMAIL,
password: PASSWORD
password: PASSWORD,

// This option force login even other devices are logon
forced: true,
};

const api = await AuthApiClient.create(DEVICE_NAME, DEVICE_UUID);
const loginRes = await api.login(form, true);
const loginRes = await api.login(form);
if (loginRes.success) throw new Error('Device already registered!');
if (loginRes.status !== KnownAuthStatusCode.DEVICE_NOT_REGISTERED) {
throw new Error(`Web login failed with status: ${loginRes.status}`);
Expand All @@ -54,7 +57,7 @@ async function main() {
console.log(`Device ${DEVICE_UUID} has been registered`);

// Login after registering devices
const loginAfterRes = await api.login(form, true);
const loginAfterRes = await api.login(form);
if (!loginAfterRes.success) throw new Error(`Web login failed with status: ${loginAfterRes.status}`);
console.log(`Client logon successfully`);
}
Expand Down

0 comments on commit dd8cbae

Please sign in to comment.