Authorization error with jTwitter for android

眉间皱痕 提交于 2019-12-04 06:32:25

问题


I am using jTwitter library in my android application. Till day before yesterday everything was working fine. But today am getting exception "Service provider responded in error : 301". Kindly help me.

Here is ther stack trace :

02-21 21:07:27.258: E/AndroidRuntime(4013): FATAL EXCEPTION: AsyncTask #1
02-21 21:07:27.258: E/AndroidRuntime(4013): java.lang.RuntimeException: An error occured while executing doInBackground()
02-21 21:07:27.258: E/AndroidRuntime(4013):     at android.os.AsyncTask$3.done(AsyncTask.java:299)
02-21 21:07:27.258: E/AndroidRuntime(4013):     at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
02-21 21:07:27.258: E/AndroidRuntime(4013):     at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
02-21 21:07:27.258: E/AndroidRuntime(4013):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
02-21 21:07:27.258: E/AndroidRuntime(4013):     at java.util.concurrent.FutureTask.run(FutureTask.java:137)
02-21 21:07:27.258: E/AndroidRuntime(4013):     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
02-21 21:07:27.258: E/AndroidRuntime(4013):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
02-21 21:07:27.258: E/AndroidRuntime(4013):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
02-21 21:07:27.258: E/AndroidRuntime(4013):     at java.lang.Thread.run(Thread.java:856)
02-21 21:07:27.258: E/AndroidRuntime(4013): Caused by: winterwell.jtwitter.TwitterException: oauth.signpost.exception.OAuthCommunicationException: Communication with the service provider failed: Service provider responded in error: 301 (Moved Permanently)
02-21 21:07:27.258: E/AndroidRuntime(4013):     at winterwell.jtwitter.OAuthSignpostClient.authorizeUrl(OAuthSignpostClient.java:307)
02-21 21:07:27.258: E/AndroidRuntime(4013):     at com.example.retrieve.contacts.twitter.MainActivity$MyTask.doInBackground(MainActivity.java:363)
02-21 21:07:27.258: E/AndroidRuntime(4013):     at com.example.retrieve.contacts.twitter.MainActivity$MyTask.doInBackground(MainActivity.java:1)
02-21 21:07:27.258: E/AndroidRuntime(4013):     at android.os.AsyncTask$2.call(AsyncTask.java:287)
02-21 21:07:27.258: E/AndroidRuntime(4013):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
02-21 21:07:27.258: E/AndroidRuntime(4013):     ... 5 more
02-21 21:07:27.258: E/AndroidRuntime(4013): Caused by: oauth.signpost.exception.OAuthCommunicationException: Communication with the service provider failed: Service provider responded in error: 301 (Moved Permanently)
02-21 21:07:27.258: E/AndroidRuntime(4013):     at oauth.signpost.AbstractOAuthProvider.retrieveToken(AbstractOAuthProvider.java:214)
02-21 21:07:27.258: E/AndroidRuntime(4013):     at oauth.signpost.AbstractOAuthProvider.retrieveRequestToken(AbstractOAuthProvider.java:69)
02-21 21:07:27.258: E/AndroidRuntime(4013):     at winterwell.jtwitter.OAuthSignpostClient.authorizeUrl(OAuthSignpostClient.java:303)
02-21 21:07:27.258: E/AndroidRuntime(4013):     ... 9 more
02-21 21:07:27.258: E/AndroidRuntime(4013): Caused by: oauth.signpost.exception.OAuthCommunicationException: Service provider responded in error: 301 (Moved Permanently)
02-21 21:07:27.258: E/AndroidRuntime(4013):     at oauth.signpost.AbstractOAuthProvider.handleUnexpectedResponse(AbstractOAuthProvider.java:241)
02-21 21:07:27.258: E/AndroidRuntime(4013):     at oauth.signpost.AbstractOAuthProvider.retrieveToken(AbstractOAuthProvider.java:189)

回答1:


Twitter changed their API. It's a trivial but annoying change to the oauth url.

This is fixed in the latest version of JTwitter (2.7) -- which you can download from the JTwitter webpage



来源:https://stackoverflow.com/questions/15006443/authorization-error-with-jtwitter-for-android

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