geduldig / TwitterAPI

Minimal python wrapper for Twitter's REST and Streaming APIs
936 stars 263 forks source link

Bearer Token Issue with Academic Access in Twitter API V2 #214

Closed mattandryc closed 2 years ago

mattandryc commented 2 years ago

I run into the following exception when trying use "oAuth2" on the /tweets/search/all endpoint (api_version='2') with my consumer_key and consumer_secret:

"Error requesting bearer access token: access_token"

It seems the request in BearerAuth.py is not returning the bearer token associated with my app (strangely I get a Not Authorized 401 response).

Twitter's official documentation points to grabbing the bearer token from the developer dashboard directly → https://developer.twitter.com/en/docs/authentication/oauth-2-0/bearer-tokens as opposed to using the POST oauth2/token endpoint.

Has anyone else run into this issue?

geduldig commented 2 years ago

Make sure OAuth2 is enabled in the Developer Portal under "Keys and tokens".