I created a new project on the dashboard, and a new application under it. I’ve tried regenerating the api key and secret, access token and secret, and bearer token more than once, but everytime I get the same result
What endpoint are you using?
/2/tweets
What API version are you on?
Version 2
Are you using a library or SDK? Which one?
twitter-api-java-sdk - version 2.0.3
What is the issue?
I’m trying to create an TwitterApi instance using a bearer token for credentials for a bot account, but I’m getting a 401 Unauthorized error
Steps to reproduce the issue
Step 1:
TwitterCredentialsBearer credentials = new TwitterCredentialsBearer(System.getenv(“TWITTER_CONSUMER_KEY”));
TwitterApi apiInstance = new TwitterApi(credentials);
TweetCreateRequest tweet = new TweetCreateRequest().text(“Text API v2”); TweetCreateResponse result = apiInstance.tweets().createTweet(tweet).execute();
Step 2:
What is the error message?
Status code: 401
Reason: {
“title”: “Unauthorized”,
“type”: “about:blank”,
“status”: 401,
“detail”: “Unauthorized”
}
When did it start?
This week
What have you tried to troubleshoot?
Have tried implementing the same workflow using the nodeJS library, with the same result
I’ve tried creating the authorization url, but the opening the url at https://twitter.com/i/oauth2/authorize?… just gives this error, even though I’m logged in correctly
" Something went wrong
You weren’t able to give access to the App. Go back and try logging in again."