Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Get user followings not working with Basic subscription #508

Open
ArtemOsuskyi opened this issue Dec 11, 2023 · 1 comment
Open

[bug] Get user followings not working with Basic subscription #508

ArtemOsuskyi opened this issue Dec 11, 2023 · 1 comment

Comments

@ArtemOsuskyi
Copy link

Here's my code snippet to do the user following fetching

public async checkUserFollows(
    currentUser: CurrentUserDto,
    { code, codeVerifier }: TwitterCodeBodyDto
  ) {
    const { accessToken } =
      await this.twitterAuthClient.loginWithOAuth2({
        code,
        codeVerifier,
        redirectUri: 'http://localhost:3005',
      });

    const user = await this.userService.findUserByEmail(
      currentUser.email
    );

    const res = await new TwitterApi(accessToken).v2.following(
      user.twitterId
    );

    return res;

    // const data = await fetch(
    //   `https://api.twitter.com/2/users/${user.twitterId}/following`,
    //   {
    //     method: 'GET',
    //     headers: {
    //       Authorization: `Bearer <bearer_token_from_dashboard/oauth2_access_token_from_above>`,
    //     },
    //   }
    // ).then((res) => res.json());
    //
    // return data;
  }

What I tried so far:

  • Instantiating TwitterApi with app/app+access secret keys
  • Fetching directly with OAuth2 access token in headers
  • Fetching directly with project bearer token in headers
  • Regenerating all tokens/secrets and redoing points above

My thought is there is something wrong with Twitter API, but if I miss something else, please tell me

@OlehSych
Copy link

OlehSych commented May 13, 2024

Hey, Artem! I've also struggled with this issue, and unfortunately, it is impossible without the Twitter Enterprise API subscription.
https://devcommunity.x.com/t/getting-all-followers-of-an-account/214611

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants