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

[Error] Bearer Token connection #458

Closed Jules010209 closed 1 year ago

Jules010209 commented 1 year ago

Hello,

When I would like to connect my account with the bearer token, the console return this error image

ApiResponseError: Request failed with code 403 at RequestHandlerHelper.createResponseError (C:\Users\Jules\Documents\Ivao\discord-bots\bot-v14\node_modules\twitter-api-v2\dist\cjs\client-mixins\request-handler.helper.js:103:16) at RequestHandlerHelper.onResponseEndHandler (C:\Users\Jules\Documents\Ivao\discord-bots\bot-v14\node_modules\twitter-api-v2\dist\cjs\client-mixins\request-handler.helper.js:252:25) at Gunzip.emit (node:events:513:28) at Gunzip.emit (node:domain:489:12) at endReadableNT (node:internal/streams/readable:1359:12) at processTicksAndRejections (node:internal/process/task_queues:82:21) { error: true, type: 'response', code: 403, headers: { date: 'Fri, 17 Mar 2023 16:45:34 UTC', perf: '7626143928', server: 'tsa_f', 'set-cookie': [ 'guest_id=v1%3A167907153453994752; Max-Age=34214400; Expires=Tue, 16 Apr 2024 16:45:34 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None' ], 'api-version': '2.61', 'content-type': 'application/json; charset=utf-8', 'cache-control': 'no-cache, no-store, max-age=0', 'content-length': '327', 'x-access-level': 'read', 'x-frame-options': 'SAMEORIGIN', 'content-encoding': 'gzip', 'x-transaction-id': 'c0a4d0afdf53629d', 'x-xss-protection': '0', 'x-rate-limit-limit': '40000', 'x-rate-limit-reset': '1679072253', 'content-disposition': 'attachment; filename=json.json', 'x-content-type-options': 'nosniff', 'x-rate-limit-remaining': '39996', 'strict-transport-security': 'max-age=631138519', 'x-response-time': '112', 'x-connection-hash': 'f4bae833600bb6f9c1799d7da1b3283aae0cc63865a1af94947e6643559d21c1', connection: 'close' }, rateLimit: { limit: 40000, remaining: 39996, reset: 1679072253 }, data: { client_id: '16112662', detail: 'When authenticating requests to the Twitter API v2 endpoints, you must use keys and tokens from a Twitter developer App that is attached to a Project. You can create a project via the developer portal.', registration_url: 'https://developer.twitter.com/en/docs/projects/overview', title: 'Client Forbidden', required_enrollment: 'Appropriate Level of API Access', reason: 'client-not-enrolled', type: 'https://api.twitter.com/2/problems/client-forbidden' } }

Thank you, :) !

Node.js v18.13.0 Lib 1.14.2 OS windows

Jules010209 commented 1 year ago

I had resolve the problem :)

vincentpotato commented 1 year ago

How did you resolve this issue @Jules010209 ?

Jules010209 commented 1 year ago

How did you resolve this issue @Jules010209 ?

Hi, I regenerated the token and gave it all the permissions.