I am currently experiencing a persistent issue with the Twitter API v2. Despite my app being a part of a project, being set to production, and having the $100 Elevated level of Basic access, I continue to receive a 403 error when I attempt to call the https://api.twitter.com/2/tweets/search/stream/
endpoint.
Here is the error message I'm getting:
Error: Unexpected response code: 403, body: {
"client_id":"26948158",
"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"
}
at getAllRules (webpack-internal:///(api)/./pages/api/streamTweets.js:24:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async __WEBPACK_DEFAULT_EXPORT__ (webpack-internal:///(api)/./pages/api/streamTweets.js:102:28)
Even though the error message suggests that my app might not be attached to a project, I can confirm that it is indeed attached to a project and the app's status is set to production in the Twitter Developer Portal.
I'd appreciate any guidance on why this error might be occurring and how to resolve it. Thank you in advance for your assistance!
I'm in a similar situation as you are. My app, which has been running smoothly for the past two months, is now starting to display the same issue.
There's a relevant discussion happening on Twitter's community platform that might provide some helpful insight. Here's the link: https://twittercommunity.com/t/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/189699/53
In my case, the problem occurred because Twitter removed support for a specific endpoint, and the error message I received was linked to that change.