【发布时间】:2018-01-16 05:35:50
【问题描述】:
我使用 Java 上的 Twitter4j 执行以下代码在 Twitter 上发布消息:
public static void main(String[] args) throws TwitterException {
String consumerKey = ".....";
String consumerSecret = "....";
String accessToken = "....";
String accessTokenSecret = "....";
ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setDebugEnabled(true)
.setOAuthConsumerKey(consumerKey)
.setOAuthConsumerSecret(consumerSecret)
.setOAuthAccessToken(accessToken)
.setOAuthAccessTokenSecret(accessTokenSecret);
TwitterFactory tf = new TwitterFactory(cb.build());
Twitter twitter = tf.getInstance();
//Posting a Tweet
twitter.updateStatus("Hello , This is a sample tweet");
}
但是,我收到以下错误:
Exception in thread "main" 403:The request is understood, but it has been refused. An accompanying error message will explain why. This code is used when requests are being denied due to update limits (https://support.twitter.com/articles/15364-about-twitter-limits-update-api-dm-and-following).
message - SSL is required
code - 92
Relevant discussions can be found on the Internet at:
http://www.google.co.jp/search?q=b2b52c28 or
http://www.google.co.jp/search?q=0f7b8a6a
TwitterException{exceptionCode=[b2b52c28-0f7b8a6a], statusCode=403, message=SSL is required, code=92, retryAfter=-1, rateLimitStatus=null, version=3.0.0}
无论我尝试获取时间线、进行查询还是发送帖子,都会遇到同样的错误。
我认为我无法达到任何限制,因为这是我第一次尝试使用 Java。 有人知道原因吗?
【问题讨论】:
标签: java twitter twitter-oauth twitter4j credentials