node-twitter-api-v2 icon indicating copy to clipboard operation
node-twitter-api-v2 copied to clipboard

Unit tests failing with project keys

Open gregory-h opened this issue 2 years ago • 0 comments

We are having difficulty understanding authentication, and would like to use the unit tests as a guide. To that end we have setup an .env file in the project root populated with our app keys from the twitter developer portal, ie:

CONSUMER_TOKEN="..." CONSUMER_SECRET="..." BEARER_TOKEN="..." OAUTH_TOKEN="..." OAUTH_SECRET="..."

We've recently regenerated these keys in the developer console, but running npm test returns most tests failing with invalid or expired token, for example,

  1. Tweets endpoints for v1.1 API .get - Get 2 tweets of a specific user: Error: Request failed with code 401 - Invalid or expired token. (Twitter code 89) at RequestHandlerHelper.createResponseError (src/client-mixins/request-handler.helper.ts:108:12) at RequestHandlerHelper.onResponseEndHandler (src/client-mixins/request-handler.helper.ts:285:19) at Gunzip.emit (domain.js:475:12) at endReadableNT (internal/streams/readable.js:1333:12) at processTicksAndRejections (internal/process/task_queues.js:82:21)

Looking for clarification of how to map the Developer Portal keys from our project/app onto the .env file, or other suggestions?

Help appreciated, thanks

gregory-h avatar Apr 12 '23 01:04 gregory-h