2

I am working on an academic research project and I am trying to send out tweets using the the Twitter API. The error I am receiving repeatedly is

Forbidden: 403 Forbidden
Your client app is not configured with the appropriate oauth1 app permissions for this endpoint.
import tweepy

#from tweepy import OAuthHandler

ACCESS_KEY = 'xxx'
ACCESS_SECRET = 'xxx'
CONSUMER_KEY = 'xxx'
CONSUMER_SECRET = 'xxx'


api = tweepy.Client(bearer_token='xxx',
                    access_token=ACCESS_KEY,
                    access_token_secret=ACCESS_SECRET,
                    consumer_key=CONSUMER_KEY,
                    consumer_secret=CONSUMER_SECRET)


api.create_tweet(text='I want to Tweet')

Here is my code. The authentication raises no errors. Just the attempt at tweeting.

Evan
  • 21
  • 1
  • 3

1 Answers1

15

You can fix the problem by activating Read / Write in the Oauth section of your application, and then you shall regenerate the "Access Token and Secret".

You can check that are properly recreated when you see:

Created with Read and Write permissions

EDIT as of 10/February/2023: You are now required to ask for Elevated access if you want to have read + write permission. You only have read access from the V2 API Endpoints as of today

pablofdezr
  • 153
  • 1
  • 1
  • 7