Twitter 401身份验证错误(Thread.sleep()不同步me时钟)
在发布这些问题之前,我考虑了很多。关于Twitter 401身份验证错误(Thread.sleep()不同步me时钟),twitter,clock,synchronizing,Twitter,Clock,Synchronizing,在发布这些问题之前,我考虑了很多。关于Twitter和Twitter4jAPI,我有几个问题。我正在收集Twitter用户的追随者。它运行良好一段时间,然后显示错误 401:Authentication credentials ( http://dev.twitter.com/pages/auth) were missing or incorrect. Ensure that you have set valid conumer key cret, access token cret, and
Twitter
和Twitter4j
API,我有几个问题。我正在收集Twitter用户的追随者。它运行良好一段时间,然后显示错误
401:Authentication credentials ( http://dev.twitter.com/pages/auth) were missing or incorrect. Ensure that you have set valid conumer key cret, access token cret, and the system clock in in sync.
error - Timestamp out of bounds
request - /1/account erify_credentials.json?include_entities=false
Relevant discussions can be on the Internet at:
http://www.google.co.jp/search?q=6f0f59ca or
http://www.google.co.jp/search?q=3f8a87d4
TwitterException{exceptionCode=[6f0f59ca-3f8a87d4], statusCode=401, retryAfter=0, rateLimitStatus=null, version=2.2.0}
at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:189)
at twitter4j.internal.http.HttpClientWrapper.request(HttpClientWrapper.java:65)
at twitter4j.internal.http.HttpClientWrapper.get(HttpClientWrapper.java:93)
at twitter4j.TwitterBaseImpl.fillInIDAndScreenName(TwitterBaseImpl.java:131)
at twitter4j.TwitterImpl.verifyCredentials(TwitterImpl.java:1150)
at com.xinlab.blueapple.twitterrobot.ConvertRobot$1.run(ConvertRobot.java:77)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
Failed to get mentions: 401:Authentication credentials ( http://dev.twitter.com/pages/auth) were missing or incorrect. Ensure that you have set valid conumer key cret, access token cret, and the system clock in in sync.
error - Timestamp out of bounds
request - /1/account erify_credentials.json?include_entities=false
我在网上看过,但没有得到正确的答案。一些人建议同步你的时钟,但没有人提到如何同步(我不知道这是不是问题,可能还有其他问题)
凭证不能出错,因为它可以正常工作15-20分钟。我还想告诉大家,我也在使用Thread.sleep(x)
,因为Twitter不允许每小时请求超过350个查询
因此,如果问题在于时间同步,正如大多数用户在其他帖子中所说的那样,那么这与Thread.sleep(12000)
更新:我发现我出错的时间点是Twitter向其tweet受到保护的用户请求关注者的时间点。与此有关吗?同步时钟的建议是因为请求有一个时间戳,当它生成用于验证请求的签名时,该时间戳用于种子散列算法 签名特定于提出的请求、提出签名的人、提出签名的应用程序、提出签名的时间以及另一个随机值 请求是时间敏感的,因此服务(Twitter)将检查时间戳是否在+/-时间内。确切时间不得而知,但服务应尽可能缩短时间
您应该使用internet时间服务同步系统时钟。下面是Google为我提供的一篇关于在linux中设置时间的文章:同步时钟的建议是因为请求有一个时间戳,当它生成用于验证请求的签名时,该时间戳用于为哈希算法种子 签名特定于提出的请求、提出签名的人、提出签名的应用程序、提出签名的时间以及另一个随机值 请求是时间敏感的,因此服务(Twitter)将检查时间戳是否在+/-时间内。确切时间不得而知,但服务应尽可能缩短时间
您应该使用internet时间服务同步系统时钟。这里有一篇谷歌为我提供的关于在linux中设置时间的文章:是的,建议检查/同步你的时钟。我也试着这么做,并且不断更新我的系统时间(笔记本电脑/个人电脑)。1小时后,我注意到模拟器的系统时间与服务器不同步。我停止emulator并重新启动它,它工作了。您还可以从以下位置手动更改系统时间:
谢谢大家! 是的,建议检查/同步时钟。我也试着这么做,并且不断更新我的系统时间(笔记本电脑/个人电脑)。1小时后,我注意到模拟器的系统时间与服务器不同步。我停止emulator并重新启动它,它工作了。您还可以从以下位置手动更改系统时间:
- 请转到“日期和时间设置”
- 将时间自动设置为ON
- 重新启动模拟器
- 请转到“日期和时间设置”
- 将时间自动设置为ON
- 重新启动模拟器