嗨伙计们,我在使用twitter4j进行webapp oauth时遇到了麻烦,代码是
//I changed from val to var
var twit = TwitterFactory.getSingleton
twit.setOAuthConsumer("oAUMN69x14PKmMhjr3RyQ","1C4fAnW3LAZYG8M4Sl0n9KzYcExW30xTL8S9U")
val reqst = twit.getOAuthRequestToken
现在我只是测试它,所以我生成了网址 reqst.getAuthorizationURL
并从网址
复制 oauth_verifier没有必要使用 oauth_token ?
http://127.0.0.1/auth/twitter/callback?oauth_token=2sGINg *** n6YSJ4& oauth_verifier = xNdDA ***** OfL
val tok = twit.getOAuthAccessToken(reqst.getToken, "xNdDA...OfL")
此行导致错误
twitter4j.TwitterException: 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).
The screen name / password combination seems to be invalid.
at twitter4j.auth.OAuthAuthorization.getOAuthAccessToken(OAuthAuthorization.java:165)
at twitter4j.TwitterBaseImpl.getOAuthAccessToken(TwitterBaseImpl.java:372)
... 30 elided
Caused by: twitter4j.TwitterException: 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).
<?xml version="1.0" encoding="UTF-8"?><errors><error code="87">Client is not permitted to perform this action</error></errors>
at twitter4j.HttpClientImpl.handleRequest(HttpClientImpl.java:164)
at twitter4j.HttpClientBase.request(HttpClientBase.java:57)
at twitter4j.HttpClientBase.post(HttpClientBase.java:86)
at twitter4j.auth.OAuthAuthorization.getOAuthAccessToken(OAuthAuthorization.java:158)
... 31 more
可能是什么错误?...谢谢!!