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

`username` and `password` shouldn't be required when `token` and `userId` are provided #132

Closed LilaRest closed 12 months ago

LilaRest commented 12 months ago

Hi! I'm actually storing token and userId to disk to prevent requesting login again between restarts of my app.

While initializing the ThreadsAPI object, giving those to it without username and password will throw Error: Username or password not set when calling `publish() (and maybe on other methods, not tried yet).

However, I've quickly browsed the code of the publish() method and it seems that it doesn't require neither username nor the password as soon as token and userId are available.

As a current workaround I'm instanciating ThreadsAPI with dummy username and password: new ThreadsAPI({ username: " ", password: " ", token: token, userID: userId });

junhoyeo commented 12 months ago

oh my god, nice point, thanks!

cedriking commented 12 months ago

I've sent a PR fix for this. Seems the issue is only in publish().

junhoyeo commented 12 months ago

Deployed in v1.4.1 🥳 Thanks @cedriking @LilaRest 🙏

LilaRest commented 12 months ago

Awesome, thanks @cedriking and @junhoyeo :)