Twitter4j 抛出 401 身份验证错误
当我尝试使用自己的凭据访问 Twitter 时,出现以下身份验证错误。有人能告诉我可能是什么问题吗?
401:身份验证凭据 (https://dev.twitter.com/docs/auth) 丢失或不正确。确保您已设置有效的消费者密钥/秘密、访问令牌/秘密以及同步的系统时钟。
Tests run: 6, Failures: 0, Errors: 5, Skipped: 0, Time elapsed: 4.953 sec <<< FAILURE!
showStatusTest(com.mycompany.twitter.test.TwitterClientTest) Time elapsed: 0.672 sec <<< ERROR!
401:Authentication credentials (https://dev.twitter.com/docs/auth) were missing or incorrect. Ensure that you have set valid conumer key/secret, access token/secret, and the system clock in in sync.
TwitterException{exceptionCode=[6b80c41c-1bd1da85], statusCode=401, retryAfter=-1, rateLimitStatus=null, featureSpecificRateLimitStatus=null, version=2.2.5-SNAPSHOT(build: 5f9c44cd0e0c1972f8d17653a226b9b6a3392ac2)}
at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:185)
at twitter4j.internal.http.HttpClientWrapper.request(HttpClientWrapper.java:65)
at twitter4j.internal.http.HttpClientWrapper.get(HttpClientWrapper.java:93)
at twitter4j.TwitterImpl.get(TwitterImpl.java:1869)
at twitter4j.TwitterImpl.showStatus(TwitterImpl.java:445)
I am getting the following authentication error when trying to access Twitter using my own credentials. Can someone tell what the problem could be?
401:Authentication credentials (https://dev.twitter.com/docs/auth) were missing or incorrect. Ensure that you have set valid conumer key/secret, access token/secret, and the system clock in in sync.
Tests run: 6, Failures: 0, Errors: 5, Skipped: 0, Time elapsed: 4.953 sec <<< FAILURE!
showStatusTest(com.mycompany.twitter.test.TwitterClientTest) Time elapsed: 0.672 sec <<< ERROR!
401:Authentication credentials (https://dev.twitter.com/docs/auth) were missing or incorrect. Ensure that you have set valid conumer key/secret, access token/secret, and the system clock in in sync.
TwitterException{exceptionCode=[6b80c41c-1bd1da85], statusCode=401, retryAfter=-1, rateLimitStatus=null, featureSpecificRateLimitStatus=null, version=2.2.5-SNAPSHOT(build: 5f9c44cd0e0c1972f8d17653a226b9b6a3392ac2)}
at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:185)
at twitter4j.internal.http.HttpClientWrapper.request(HttpClientWrapper.java:65)
at twitter4j.internal.http.HttpClientWrapper.get(HttpClientWrapper.java:93)
at twitter4j.TwitterImpl.get(TwitterImpl.java:1869)
at twitter4j.TwitterImpl.showStatus(TwitterImpl.java:445)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
通过设置适当的
同步系统时钟
解决了上述异常。The above exception was solved by setting the appropriate
system clock in sync
.您是否在应用程序中提供了正确的消费者密钥和访问令牌?请阅读此处
Have you supplied correct consumer keys and access tokens in the application..? Read here