I'm building an app using the Twitter API V2.0 to get user info by username and it is returning me a code 203 response.
Code:
const { TwitterApi } = require('twitter-api-v2');
const twitterClient = new TwitterApi(tokens.BEARER);
const roClient = twitterClient.readOnly;
const user = await roClient.v2.userByUsername('plhery');
console.log(user);
Response:
(node:404) UnhandledPromiseRejectionWarning: Error: Request failed with code 403
at RequestHandlerHelper.createResponseError (C:\Users\IGOR\Documents\Code\Node\famoso_falou\node_modules\twitter-api-v2\dist\client-mixins\request-handler.helper.js:73:16)
at IncomingMessage.<anonymous> (C:\Users\IGOR\Documents\Code\Node\famoso_falou\node_modules\twitter-api-v2\dist\client-mixins\request-handler.helper.js:114:33)
at IncomingMessage.emit (events.js:412:35)
at endReadableNT (internal/streams/readable.js:1317:12)
at processTicksAndRejections (internal/process/task_queues.js:82:21)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:404) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:404) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.