threads-api icon indicating copy to clipboard operation
threads-api copied to clipboard

Cannot read properties of undefined (reading 'split')

Open onesyah05 opened this issue 2 years ago • 7 comments

i want use like and post method but something error

TypeError: Cannot read properties of undefined (reading 'split') at d. (D:\quote_threads\node_modules\threads-api\build\threads-api.js:1:9817) at D:\quote_threads\node_modules\threads-api\build\threads-api.js:1:1769 at Object.next (D:\quote_threads\node_modules\threads-api\build\threads-api.js:1:1874) at o (D:\quote_threads\node_modules\threads-api\build\threads-api.js:1:350) at i (D:\quote_threads\node_modules\threads-api\build\threads-api.js:1:547) at process.processTicksAndRejections (node:internal/process/task_queues:95:5

onesyah05 avatar Jul 12 '23 07:07 onesyah05

Having the same issue! Any progress with it @onesyah05 ?

ishaanbedi avatar Jul 12 '23 11:07 ishaanbedi

I’m pretty sure that the Threads team changed how auth works

I made an issue before documenting what I found https://github.com/junhoyeo/threads-api/issues/113

francistogram avatar Jul 12 '23 12:07 francistogram

need to encrypt password before send login request start with #PWD_INSTAGRAM:{keyId}:{time}:{ecnryptedpassword}. public key is stored hardcode on the app with keyId.

this is reference for implementation: https://github.com/dilame/instagram-private-api/blob/master/src/repositories/account.repository.ts, all the logic same with ig authorization.

aldinp16 avatar Jul 12 '23 13:07 aldinp16

@aldinp16 how do you get the keyId it seems like within the instagram-private-api it's hard coded to 4?

francistogram avatar Jul 12 '23 15:07 francistogram

@francistogram try to open the apk with jadx, the key id is harcoded on apk with the public key for generate encrypted password

public C95815gG() {
        this.A00 = 41;
        this.A02 = "-----BEGIN PUBLIC KEY-----\n*****-----END PUBLIC KEY-----\n";
        Calendar.getInstance().getTimeInMillis();
        this.A01 = AnonymousClass006.A00;
}

even though the request uses key 1 (#PWD_INSTAGRAM:1:{time}:{ecnryptedpassword}), in fact it uses key 41 to encrypt it

aldinp16 avatar Jul 12 '23 16:07 aldinp16

@francistogram @aldinp16 Thank you guys for the research, will try to draft an quick implementation in a few hours

junhoyeo avatar Jul 12 '23 16:07 junhoyeo

@junhoyeo This other Threads library seems to have fixed this issue in this commit, it may be inspiring for your implementation: https://github.com/threadsjs/threads.js/commit/975abe82789c891815d0ef7128051bb1b30023f0

LilaRest avatar Jul 12 '23 17:07 LilaRest

almost done!

junhoyeo avatar Jul 12 '23 18:07 junhoyeo

Thanks to everyone, It was released in v1.4.0! 👍

junhoyeo avatar Jul 12 '23 19:07 junhoyeo

Sorry to comment on a closed issue, but I'm still experiencing this after updating to v1.4.0. Is anyone else still experiencing the issue?

ERROR (threads/64596): Cannot read properties of undefined (reading 'split')
    TypeError: Cannot read properties of undefined (reading 'split')

cedriking avatar Jul 13 '23 02:07 cedriking