storycraft / node-kakao

Loco protocol compatible library
MIT License
405 stars 115 forks source link

TalkClient.login fails with -999 #371

Closed luftaquila closed 3 years ago

luftaquila commented 3 years ago

Describe the bug TalkClient.login method fails with status -999 update required

To Reproduce

const api = await AuthApiClient.create(process.env.TalkClientName, process.env.TalkClientUUID);
const loginRes = await api.login({ email: process.env.TalkClientLoginID, password: process.env.TalkClientLoginPW });
if(!loginRes.success) return console.error(`Web API Login failure: ${loginRes.status}`);

const client = new TalkClient({
  version: '3.2.7',
  appVersion: '3.2.7.2782'
});
const clientLoginRes = await client.login(loginRes.result);
if(!clientLoginRes.success) return console.error(`TalkClient Login failure: ${clientLoginRes.status}`);

TalkClient with no configs like new TalkClient({ }) on the migration-v3.md makes client with config: version: '3.2.3', appVersion: '3.2.3.2698'

So I changed version config to my PC client's newest version: 3.2.7.2782 since the error code is UPGRADE_REQUIRED, but the problem continues. TypeDoc says expected option should be like new TalkClient({ config: { appVersion: '3.2.7.2782' } }) but this is not changing the version.

Expected behavior Successful TalkClient login

Screenshots

nunnu1028 commented 3 years ago

잘 작동합니다만?

luftaquila commented 3 years ago

잘 작동합니다만?

v3 사용하다가 어느 순간부터 -999 에러가 나서 v4로 넘어온건데 저는 계속 동일한 문제가 생기네요. -999 에러가 업데이트가 필요하다고 말하는게 클라이언트 버전이 맞는 건가요?

storycraft commented 3 years ago

잘 작동합니다.

환경변수 값이 제대로 적용되고 있는게 맞나요? 몇몇 인자가 제공되지 않은 경우에도 -999를 반환했던 것으로 기억합니다

luftaquila commented 3 years ago

잘 작동합니다.

환경변수 값이 제대로 적용되고 있는게 맞나요? 몇몇 인자가 제공되지 않은 경우에도 -999를 반환했던 것으로 기억합니다

v3 사용하는 도중에 코드를 바꾼 적 없는데도 어느 순간부터 -999 에러가 나와서 v4로 옮겨본 거라 환경 변수 자체는 제대로 들어가고 있습니다. 제 클라이언트에선 무슨 옵션을 넣어도 -999가 돌아오는데 뭘 바꿔야 할 지 모르겠네요 :(

nunnu1028 commented 3 years ago

잘 작동합니다. 환경변수 값이 제대로 적용되고 있는게 맞나요? 몇몇 인자가 제공되지 않은 경우에도 -999를 반환했던 것으로 기억합니다

v3 사용하는 도중에 코드를 바꾼 적 없는데도 어느 순간부터 -999 에러가 나와서 v4로 옮겨본 거라 환경 변수 자체는 제대로 들어가고 있습니다. 제 클라이언트에선 무슨 옵션을 넣어도 -999가 돌아오는데 뭘 바꿔야 할 지 모르겠네요 :(

그리고, TalkClient의 login메소드에서 그러한 오류가 발생하나요?

AlphaDoStar commented 3 years ago

오랜만에 돌려봤는데 동일 현상이 발생하네요.

luftaquila commented 3 years ago

잘 작동합니다. 환경변수 값이 제대로 적용되고 있는게 맞나요? 몇몇 인자가 제공되지 않은 경우에도 -999를 반환했던 것으로 기억합니다

v3 사용하는 도중에 코드를 바꾼 적 없는데도 어느 순간부터 -999 에러가 나와서 v4로 옮겨본 거라 환경 변수 자체는 제대로 들어가고 있습니다. 제 클라이언트에선 무슨 옵션을 넣어도 -999가 돌아오는데 뭘 바꿔야 할 지 모르겠네요 :(

그리고, TalkClient의 login메소드에서 그러한 오류가 발생하나요?

네.

const clientLoginRes = await client.login(loginRes.result);

이 부분에서 응답이 { status: -999, success: false }로 돌아옵니다.

JellyBrick commented 3 years ago

오류 코드

코드 ID 설명
-999 UPGRADE_REQUIRED 클라이언트 버전이 너무 낮음

혹시 버전명을 따로 정의해두셨나요?

luftaquila commented 3 years ago

TalkClient with no configs like new TalkClient({ }) on the migration-v3.md makes client with config: version: '3.2.3', appVersion: '3.2.3.2698'

So I changed version config to my PC client's newest version: 3.2.7.2782 since the error code is UPGRADE_REQUIRED, but the problem continues.

이러한 이유로

const client = new TalkClient({
  version: '3.2.7',
  appVersion: '3.2.7.2782'
});

와 같이 PC 클라이언트 최신버전과 같은 숫자로도 바꿔 봤지만 바꾸지 않았을 때나 바꿨을 때나 똑같은 문제가 발생합니다.

JellyBrick commented 3 years ago

@luftaquila XVC는 변경하지 않으신거죠?

AlphaDoStar commented 3 years ago

@luftaquila XVC는 변경하지 않으신거죠?

저같은 경우는 불과 한 달 전까지 잘 쓰던 코드가 갑자기 작동하지 않네요.

luftaquila commented 3 years ago

@luftaquila XVC는 변경하지 않으신거죠?

네 뭔지 잘 몰라서 건드리지 않았습니다.

저같은 경우는 불과 한 달 전까지 잘 쓰던 코드가 갑자기 작동하지 않네요.

저도 항상 띄워두던 서비스에서 어느 순간부터 갑자기 멈춰서 이슈 올리게 됐습니다...

AlphaDoStar commented 3 years ago

저도 항상 띄워두던 서비스에서 어느 순간부터 갑자기 멈춰서 이슈 올리게 됐습니다...

방금 해결해서 방법 공유합니다. 아마도 신버전에서 다시 인증을 거쳐야 하는 듯 합니다.

  1. 해당 계정을 모바일 디바이스에서 접속
  2. 기기 연결 관리 > 인증 기기 관리에서 본래 사용중인 Client Name 해제
  3. device registration

제가 작성한 코드는 아래와 같고...

import * as Kakao from 'node-kakao';
import * as Readline from 'readline';

(async function login() {
    const form = {
        email: EMAIL,
        password: PASSWORD,
        forced: true
    };

    const api = await Kakao.AuthApiClient.create(DEVICE_NAME, DEVICE_UUID);
    const apiLoginRes =  await api.login(form);

    if (apiLoginRes.success) {
        console.log(`Received access token: ${apiLoginRes.result.accessToken}`);

        const clientLoginRes = await CLIENT.login(apiLoginRes.result);

        if (!clientLoginRes.success)
            throw new Error(`Login failed with status: ${clientLoginRes.status}`);

        console.log('Login success');

    } else if (apiLoginRes.status !== Kakao.KnownAuthStatusCode.DEVICE_NOT_REGISTERED) {
        throw new Error(`Web login failed with status: ${apiLoginRes.status}`);

    } else {
        const passcodeRes = await api.requestPasscode(form);

        if (!passcodeRes.success)
            throw new Error(`Passcode request failed with status: ${passcodeRes.status}`);

        const inputInterface = Readline.createInterface({
            input: process.stdin,
            output: process.stdout
        });

        const passcode = await new Promise<string>((resolve) => inputInterface.question('Enter passcode: ', resolve));

        inputInterface.close();

        const registerRes = await api.registerDevice(form, passcode, true);

        if (!registerRes.success)
            throw new Error(`Device registration failed with status: ${registerRes.status}`);

        console.log(`Device ${DEVICE_UUID} has been registered`);
        console.log('Attempting to login...');
        login();
    }
})();

image

혹은 https://github.com/storycraft/node-kakao/blob/stable/examples/device-registration.ts 참고하시면 될 것 같습니다.

luftaquila commented 3 years ago

방금 해결해서 방법 공유합니다. 아마도 신버전에서 다시 인증을 거쳐야 하는 듯 합니다.

감사합니다. 해결했습니다.

Adebesin-Cell commented 2 months ago

안녕하세요,

스레드가 닫혔음에도 불구하고 여기에 설명된 것과 동일한 문제가 발생했음을 보고하고 싶었습니다. 이 스레드에서 논의된 솔루션을 시도했지만 성공하지 못했습니다. 이 문제를 재개하는 것을 고려해 볼 수 있습니까? 아니면 잠재적인 해결 방법에 대한 업데이트된 지침이 있습니까? 이것이 내 현재 프로젝트에 영향을 미치므로 도움을 주시면 대단히 감사하겠습니다.

감사합니다!

hui1601 commented 2 months ago

@Adebesin-Cell The project was discontinued by the maintainer due to several service abuse issues.

After 2021-11-22 00:00, the NodeKakao project will be discontinued, including all updates including feature additions and bug fixes.

The NodeKakao library was originally planned in September 2019 for the purpose of learning TypeScript, a bot library for personal use. As the project progressed and, after many difficulties, reached a feasible level, I gave up on the project. Then, in April 2020, I heard that this repository was made known to several places by a user. With the expectation that unofficial cross-platform, especially Linux client development could be achieved using this library, development such as refactoring and adding features was possible as a library that can be used for general purposes. However, whenever I add a new feature, the only news I hear is abuse and criticism of the library's features. Now that I have lost the motivation to proceed with the project, I believe that further development will be difficult, so I am discontinuing the NodeKakao project.

NodeKakao 4.5.0 is the last version uploaded to npm.

This repository will be archived on 2021-12-01 00:00.

thank you

812

During the period when node-kakao was terminated, changes occurred in communication encryption. The changed protocol encryption part can be found in the KiwiTalk implementation section. https://github.com/storycraft/node-kakao/issues/842#issuecomment-1753090265

storycraft commented 2 months ago

안녕하세요,

스레드가 닫혔음에도 불구하고 여기에 설명된 것과 동일한 문제가 발생했음을 보고하고 싶었습니다. 이 스레드에서 논의된 솔루션을 시도했지만 성공하지 못했습니다. 이 문제를 재개하는 것을 고려해 볼 수 있습니까? 아니면 잠재적인 해결 방법에 대한 업데이트된 지침이 있습니까? 이것이 내 현재 프로젝트에 영향을 미치므로 도움을 주시면 대단히 감사하겠습니다.

감사합니다!

@Adebesin-Cell This project is terminated from years ago. They changed/updated authentication method since. And prohibited old versions from accessing. The auth code in the library is now incorrect.

You need to override config used in AuthApiClient too AND fix incorrect auth codes to use this library.

Adebesin-Cell commented 2 months ago

Thank you both for your responses @storycraft @hui1601. I understand that the project has been discontinued, and I appreciate the detailed history and clarification. Given the situation, I will look into the KiwiTalk implementation for guidance on the encryption changes and explore modifying the AuthApiClient as suggested. If there are any additional resources or documentation that could assist with these modifications, please let me know. Thank you again for your help and the time you've spent maintaining this project in the past.

RIP node-kakao