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

ERR: Not able to publish new thread using the API v1.3.1

Open sudarshanmg opened this issue 1 year ago • 10 comments

Problem:

  • I tried using the latest version 1.3.1 of threads-api

  • Publishing new thread using the publish() method fails using the code below:

    image

  • Instead, it returns an error:

    image

  • All the other methods works perfectly fine.

sudarshanmg avatar Jul 12 '23 06:07 sudarshanmg

same problem

yekayee avatar Jul 12 '23 06:07 yekayee

Try to get the token with and pass it manually

const token = await threadsAPI.getToken()
  const threadsAPI = new ThreadsAPI({
    token: `${token}`,
    username: '${username}', // Your username
    password: `${password}`, // Your password
  });

Aerglonus avatar Jul 12 '23 06:07 Aerglonus

In your code, You cannot access threadsAPI before initialization right? You are creating a new object named threadsAPI after you are trying to access it to get token.

sudarshanmg avatar Jul 12 '23 06:07 sudarshanmg

any example?

yekayee avatar Jul 12 '23 07:07 yekayee

Same here, it seems that the problem comes from authentication. After examining the output of const { data } = await axios<string>(LOGIN_URL, requestConfig); in getToken() method I found error messages:

  • Unable to log in
  • An unexpected error occurred. Please try logging in again.

LilaRest avatar Jul 12 '23 07:07 LilaRest

Aerglonus

can u give me example? sorry im newbie

yekayee avatar Jul 12 '23 07:07 yekayee

In your code, You cannot access threadsAPI before initialization right? You are creating a new object named threadsAPI after you are trying to access it to get token.

can u give me example? sorry im newbie

const main = async () => {
  const threadsAPI = new ThreadsAPI({
    username: 'username', // Your username
    password: 'password', // Your password
  });
  const token = await threadsAPI.getToken()
  console.log(token)
}

This is how I got the token and I was able to post again but apparently the getToken its failing #113 (with the token I got I'm still able to post )

Aerglonus avatar Jul 12 '23 07:07 Aerglonus

Username and password are required

yekayee avatar Jul 12 '23 07:07 yekayee

image

yekayee avatar Jul 12 '23 07:07 yekayee

I think we’re all having the same issue and my guess is that Threads changed how their auth flow worked so this code broke because it expected the auth token response in a certain format

https://github.com/junhoyeo/threads-api/issues/113

francistogram avatar Jul 12 '23 12:07 francistogram

Hey all, I released v1.4.0 with encrypted passwords. Please try out! 🚀

junhoyeo avatar Jul 12 '23 19:07 junhoyeo