Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/storycraft/node-kakao into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
storycraft committed Nov 13, 2021
2 parents 71033c1 + 0677942 commit d3e8cb5
Show file tree
Hide file tree
Showing 5 changed files with 176 additions and 214 deletions.
9 changes: 3 additions & 6 deletions examples/device-registration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand All @@ -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`);
}
Expand Down
Loading

0 comments on commit d3e8cb5

Please sign in to comment.