即使我在配置中添加了消费者密钥、密钥,我也会收到 401 错误。但是相同的配置文件适用于以下情况
TwitterFactory twitterFactory = new TwitterFactory(configuration);
Twitter twitterClient = twitterFactory.getInstance();
但不适用于
TwitterStreamFactory twitterStreamFactory = new TwitterStreamFactory(configuration);
TwitterStream twitterStreamClient = twitterStreamFactory.getInstance();
FilterQuery filterQuery = new FilterQuery(followersId);
twitterStreamClient.addListener(statusListener);
twitterStreamClient.filter(filterQuery);
我得到了错误
[Twitter Stream consumer-1[Establishing connection]] INFO - 401:Authentication credentials (https://dev.twitter.com/pages/auth) were missing or incorrect. Ensure that you have set valid consumer key/secret, access token/secret, and the system clock is in sync.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Error 401 Unauthorized</title>
</head>
<body>
<h2>HTTP ERROR: 401</h2>
<p>Problem accessing '/1.1/statuses/filter.json'. Reason:
<pre> Unauthorized</pre>
</body>
</html>
当我打印System.out.println(twitterStreamClient.getOAuthAccessToken().getTokenSecret());
它时,它会显示访问令牌的秘密值。我对此感到困惑。任何人都可以帮助我吗?