xdevplatform / Twitter-API-v2-sample-code

Sample code for the Twitter API v2 endpoints
https://developer.twitter.com/en/docs/twitter-api/getting-started/about-twitter-api
Apache License 2.0
2.65k stars 984 forks source link

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. #83

Open sriharigr-threado opened 2 years ago

sriharigr-threado commented 2 years ago

Describe the bug Context - We would like to use Full Archive v2 search/all endpoint. We have a premium subscription. We do not have a standalone app. We have a project and an app is added to it. I have tested using the bearer and also with the API keys. v2/search/recent works fine though. Only the v2/search/all is throwing below error.

_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. "title": "Client Forbidden", "requiredenrollment": "Standard Basic", "reason": "client-not-enrolled", To Reproduce

Expected behavior A clear and concise description of what you expected to happen.

Additional context Add any other context about the problem here.

philldtaylor commented 2 years ago

I have the same issue - have you found a fix for it yet?

andypiper commented 2 years ago

The full archive search endpoint in v2 is only available with academic access.

Typhon0130 commented 1 year ago

Now I am using this api

 await axios({
      method: "post",
      url: `https://api.twitter.com/2/dm_conversations/with/${received_user_id}/messages`,
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "Content-Type": "application/json",
        "Accept-Encoding": "gzip, deflate, br",
      },
      data: {
        text: "Hello World!",
      },
    })

And in this code, the _received_userid is User Id and the accessToken is that I created from my twitter app dashboard But when I run this code, it has some bugs like this image.😢 How can I fix it?😣 image