I'm encountering
tweepy.errors.Forbidden: 403 Forbidden
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.
while trying to run the following code that fetches a user's post history using the Twitter API and Tweepy:
client = tweepy.Client(bearer_token=bearer_token)
tweets = client.search_recent_tweets(query=f'from:{user_handle}')
My app does seem to be connected to a project (see img) I have come across some links that suggest it might be a Twitter issue related to API authentication. However, I would like to confirm if this is indeed the case and if there are any possible solutions or workarounds for this problem.
Links indicating it might be a Twitter issue:
https://github.com/twitterdev/Twitter-API-v2-sample-code/issues/58 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
I would greatly appreciate any insights, explanations, or potential solutions to resolve this issue.