Twitter API version 2 not working with OAuth 1

1.1k Views Asked by At

I used to get Tweet data using API version 1.1 like below:

import requests
from requests_oauthlib import OAuth1

oauth = OAuth1(consumer_key, consumer_secret, access_token, token_secret)
requests.get('https://api.twitter.com/1.1/statuses/show.json?id=<TWEET_ID>', auth=oauth)

It's working properly, and there is no issue at all. Now I tried to do the same thing with Twitter API version 2, but it returns 401/unauthorized

The endpoint is requests.get('https://api.twitter.com/2/tweets/<TWEET_ID>', auth=oauth)

Could someone already try Twitter version 2 successfully? Could you tell me what I need to change? From Twitter documentation, I could use the same OAuth 1.0 for API version 2.

1

There are 1 best solutions below

0
On

I found the reason, my app is standalone app, so I could not use Twitter api version 2

enter image description here