junhoyeo / threads-api

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

Can't login anymore - Cannot read properties of undefined (reading 'split') #85

Closed yssf-io closed 1 year ago

yssf-io commented 1 year ago

I think there might be login issues with newly created accounts. After a few publishes, the API cannot connect to my HackerNews bot, neither can I. When trying to connect manually (to either Instagram or Threads), I just get generic error messages, and it looks like I can't even reset my password and use the magic login Instagram link.

When trying to connect through the API I get TypeError: Cannot read properties of undefined (reading 'split'). It comes from line 496 of src/threads-api.ts, because I don't get the Bearer token.

I'm not sure we can fix this through the API given that I can't even reset my bot password manually, it most likely comes from automated Instagram anti-hack protection.

So be careful when login and publishing a lot, especially with your own account (although maybe real accounts have higher hidden "limits" than newly created ones like my bot).

Mineru98 commented 1 year ago

Exactly, so I think we need to come up with a way to store the token separately in a local environment once logged in as an additional measure.

This is something we'll be doing an update on soon.

yssf-io commented 1 year ago

I think there's already everything in the API to let devs store the token how they see fit (through getToken and the constructor's token arg).

Maybe just a warning (in the console) that says that "a new ThreadsAPI instance without a token will try to get one anytime at the first write of the instance, which can lead to disabling the account"

yssf-io commented 1 year ago

Update: the account works again, I tried various things and not sure what did it:

But the most likely is that none of the things I did above really had an impact