twitter4j xAuth authentication

可紊 提交于 2019-12-24 10:13:26

问题


I'm trying to integrate xauth authentication using the twitter4j library

I've found multiple guides similar to http://www.hiteshagrawal.com/java/twitter-xauth-permission-using-java that all indicate i should have the line:

Twitter twitter = new TwitterFactory().getInstance(username, password);

But this gives me an error, because the getInstance() method doesn't allow the parameter of two strings.

Did the twitter4j library change, or am I doing something wrong?


回答1:


Twitter deprecated Basic authentication and as of Twitter4J 2.2.0, you need to use Twitter#getOAuthAccessToken(id,password) to get the access token. http://twitter4j.org/en/versions.html#migration21x-22x



来源:https://stackoverflow.com/questions/6416133/twitter4j-xauth-authentication

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!