From 265fe64e566fabcc87a787e524495dfb0d17ee6b Mon Sep 17 00:00:00 2001 From: storycraft Date: Tue, 9 Nov 2021 11:58:55 +0900 Subject: [PATCH 1/2] Update device-registration.ts --- examples/device-registration.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/examples/device-registration.ts b/examples/device-registration.ts index 1fc488c6..59331721 100644 --- a/examples/device-registration.ts +++ b/examples/device-registration.ts @@ -27,14 +27,11 @@ const DEVICE_NAME = process.env['deviceName'] as string; async function main() { const form = { email: EMAIL, - password: PASSWORD, - - // This option force login even other devices are logon - forced: true, + password: PASSWORD }; const api = await AuthApiClient.create(DEVICE_NAME, DEVICE_UUID); - const loginRes = await api.login(form); + const loginRes = await api.login(form, true); 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}`); @@ -57,7 +54,7 @@ async function main() { console.log(`Device ${DEVICE_UUID} has been registered`); // Login after registering devices - const loginAfterRes = await api.login(form); + const loginAfterRes = await api.login(form, true); if (!loginAfterRes.success) throw new Error(`Web login failed with status: ${loginAfterRes.status}`); console.log(`Client logon successfully`); } From dd8cbaead8bc5af85e5e09108f2a18ea455e70c4 Mon Sep 17 00:00:00 2001 From: storycraft Date: Tue, 9 Nov 2021 12:02:03 +0900 Subject: [PATCH 2/2] Revert device-registration.ts Revert to a62bc6cd4da57cdf92574a69850014ad29eb00eb --- examples/device-registration.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/examples/device-registration.ts b/examples/device-registration.ts index 59331721..2ac84148 100644 --- a/examples/device-registration.ts +++ b/examples/device-registration.ts @@ -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}`); @@ -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`); }