PLhery / node-twitter-api-v2

Strongly typed, full-featured, light, versatile yet powerful Twitter API v1.1 and v2 client for Node.js.
https://www.npmjs.com/package/twitter-api-v2
Apache License 2.0
1.25k stars 175 forks source link

Unit tests failing with project keys #462

Open gregory-h opened 1 year ago

gregory-h commented 1 year ago

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,

15) 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