调用getFriendsList

时间:2015-07-29 11:24:04

标签: twitter4j

twitter.verifyCredentials() //works fine and returns my account as a User
twitter.getFriendsList(someUserId, -1, 100) //throws exception

身份验证例外:

twitter4j.TwitterException: 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.
{"request":"\/1.1\/friends\/list.json","error":"Not authorized."}

    at twitter4j.HttpClientImpl.handleRequest(HttpClientImpl.java:163) ~[org.twitter4j.twitter4j-core-4.0.3.jar:4.0.3]
    at twitter4j.HttpClientBase.request(HttpClientBase.java:53) ~[org.twitter4j.twitter4j-core-4.0.3.jar:4.0.3]
    at twitter4j.HttpClientBase.get(HttpClientBase.java:71) ~[org.twitter4j.twitter4j-core-4.0.3.jar:4.0.3]
    at twitter4j.TwitterImpl.get(TwitterImpl.java:1544) ~[org.twitter4j.twitter4j-core-4.0.3.jar:4.0.3]
    at twitter4j.TwitterImpl.getFriendsList(TwitterImpl.java:474) ~[org.twitter4j.twitter4j-core-4.0.3.jar:4.0.3]

我同步了系统时钟。但这似乎很奇怪,因为verifyCredentials工作正常,但getFriendsList抛出此异常。我还使用此帐户对此帐户进行了一些关注/取消关注,这可以正常使用。

1 个答案:

答案 0 :(得分:0)

我自己找到了原因:

我试图获得以下内容的用户受到保护。要获得以下这些,您需要获得用户的授权。