junhoyeo / threads-api

Unofficial, Reverse-Engineered Node.js/TypeScript client for Meta's Threads. Web UI Included.
https://threads.junho.io
MIT License
1.58k stars 135 forks source link

Cannot read properties of undefined (reading 'split') #118

Closed onesyah05 closed 12 months ago

onesyah05 commented 12 months ago

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

ishaanbedi commented 12 months ago

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

francistogram commented 12 months ago

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

aldinp16 commented 12 months ago

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.

francistogram commented 12 months ago

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

aldinp16 commented 12 months ago

@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

junhoyeo commented 12 months ago

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

LilaRest commented 12 months ago

@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

junhoyeo commented 12 months ago

almost done!

junhoyeo commented 12 months ago

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

cedriking commented 12 months ago

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')