xdevplatform / Twitter-API-v2-sample-code

Sample code for the Twitter API v2 endpoints
https://developer.twitter.com/en/docs/twitter-api/getting-started/about-twitter-api
Apache License 2.0
2.71k stars 998 forks source link

400 Bad Request upon using next token #40

Closed Diana0604 closed 3 years ago

Diana0604 commented 3 years ago

I am using the code in the github example page to check followers with node.js. The command works well, except when the number of followers exceeds the max.results (1000). When this happens, the code resends the request using the nextToken parameter. But the response is a 400 error (Bad Request).

After prodding through the documentation I discovered the proper parameter is pagination_token, instead of next_token. So, in the code, line 53 should change to: params.pagination_token = nextToken;

(Info from: quickstart followers documentation )

andypiper commented 3 years ago

Thank you!