question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't unfollow users! [bug]

See original GitHub issue

Describe the bug Hi, so I only want to unfollow users on my own twitter account but I keep getting a 403 forbidden.

ApiResponseError: Request failed with code 403
    at RequestHandlerHelper.createResponseError (C:\Hannes\twitter-api\node_modules\twitter-api-v2\dist\client-mixins\request-handler.helper.js:99:16)
    at RequestHandlerHelper.onResponseEndHandler (C:\Hannes\twitter-api\node_modules\twitter-api-v2\dist\client-mixins\request-handler.helper.js:227:25)
    at IncomingMessage.emit (events.js:387:35)
    at endReadableNT (internal/streams/readable.js:1317:12)
    at processTicksAndRejections (internal/process/task_queues.js:82:21) {
  error: true,
  type: 'response',
  code: 403,
  headers: {
    'content-type': 'application/problem+json',
    'cache-control': 'no-cache, no-store, max-age=0',
    'content-length': '316',
    'x-response-time': '101',
    'x-connection-hash': 'a3eedc4c11b8f6d5c8661336dfa45293f672ce7472794733705fce4c8e3dd1af',
    date: 'Wed, 02 Mar 2022 19:20:24 GMT',
    server: 'tsa_f',
    via: '1.1 google',
    'alt-svc': 'clear',
    connection: 'close'
  },
  rateLimit: undefined,
  data: '{\n' +
    '  "title": "Unsupported Authentication",\n' +
    '  "detail": "Authenticating with OAuth 2.0 Application-Only is forbidden for this endpoint.  Supported authentication types are [OAuth 1.0a User Context, OAuth 2.0 User Context].",\n' +
    '  "type": "https://api.twitter.com/2/problems/unsupported-authentication",\n' +
    '  "status": 403\n' +
    '}'
}

To Reproduce

const twitterClient = new TwitterApi({
  appKey: process.env.TWITTER_API_KEY,
  appSecret: process.env.TWITTER_API_SECRET,
  accessToken: process.env.TWITTER_ACCESS_TOKEN,
  accessSecret: process.env.TWITTER_ACCESS_TOKEN_SECRET,
});

const user = await (await twitterClient.currentUserV2()).data;
console.log(user); //I'm logged in and everything
let result = await twitterClient.v2
  .unfollow(user.id, "737251813")
  .catch((err) => {
    console.log(err);
  }); //Getting 403

Expected behavior Unfollow the user on my account

Version

  • Node.js version 14
  • Lib version 1.11.0
  • OS windows

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Hannes1commented, Mar 5, 2022

@Hannes1 what was the issue?

Hi, Probably because I forgot to enable auth 2 in the developer portal lol

// I just get the accessToken either from TwitterApi or in my next project from NextAuthjs
    const userClient = new TwitterApi(accessToken);

    let result = await userClient.v2
      .unfollow(user.id, "737251813")
      .catch((err) => {
        console.log(err);
      });
0reactions
deadcoder0904commented, Mar 5, 2022

@Hannes1 what was the issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Fix “Mass Unfollow” Limitation On Follower+ Track for IG
What happens when you unfollow too fast? ... Instagram is rigid in many cases, especially when it believes an account is spamming/using bots....
Read more >
Can't Unfollow People on Instagram? Here's The Fix - Vergizmo
You can not unfollow someone for several reasons: you hit your limit or you have unfollowed and followed too many accounts too quickly....
Read more >
Why can't I unfollow some accounts on Instagram? - Quora
If it isn't the case that you're unfollowing too many people at once, then it is likely a bug or a connection issue....
Read more >
Twitter Bug: Users can't follow, unfollow, block anyone
Multiple Twitter users reported a problem on Thursday that they can't block, follow, unfollow, block or mute anyone.
Read more >
InstaPy error, can't follow or unfollow users - Stack Overflow
A fix can be found in the following link.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found