简体   繁体   中英

Twitter4J Failed request token

Hi i'm using this tutorial

for my twitter test project and i already change :

from

mHttpOauthprovider = new DefaultOAuthProvider(" http://twitter.com/oauth/request_token ", " http://twitter.com/oauth/access_token ", " http://twitter.com/oauth/authorize ");

to

mHttpOauthprovider = new DefaultOAuthProvider(" https://api.twitter.com/oauth/request_token ", " https://api.twitter.com/oauth/access_token "," https://api.twitter.com/oauth/authorize ");

my problem is, when my apps in https://dev.twitter.com/apps/ , if i didn't fill Callback URL in that edittext, I will get error :

05-08 11:47:08.070: W/System.err(20424): oauth.signpost.exception.OAuthCommunicationException: Communication with the service provider failed: https://api.twitter.com/oauth/request_token 05-08 11:47:08.070: W/System.err(20424): at oauth.signpost.AbstractOAuthProvider.retrieveToken(AbstractOAuthProvider.java:214) 05-08 11:47:08.070: W/System.err(20424): at oauth.signpost.AbstractOAuthProvider.retrieveRequestToken(AbstractOAuthProvider.java:69) 05-08 11:47:08.070: W/System.err(20424): at sg.tv.SocialGate.TwitterCore.TwitterApp$2.run(TwitterApp.java:152) 05-08 11:47:08.070: W/System.err(20424): Caused by: java.io.FileNotFoundException: https://api.twitter.com/oauth/request_token 05-08 11:47:08.075: W/System.err(20424): at libcore.net.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:177) 05-08 11:47:08.075: W/System.err(20424): at libcore.net.http.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:271) 05-08 11:47:08.075: W/System.err(20424): at oauth.sig npost.basic.HttpURLConnectionResponseAdapter.getContent(HttpURLConnectionResponseAdapter.java:18) 05-08 11:47:08.075: W/System.err(20424): at oauth.signpost.AbstractOAuthProvider.handleUnexpectedResponse(AbstractOAuthProvider.java:228) 05-08 11:47:08.080: W/System.err(20424): at oauth.signpost.AbstractOAuthProvider.retrieveToken(AbstractOAuthProvider.java:189) 05-08 11:47:08.080: W/System.err(20424): ... 2 more

but when I fill that Callback URL I didnt get any issue. But I want to left that Callback URL edittext blank, how to solve that issue? thank you

If you don't want Twitter to redirect to a callback url you should enter 'oob' indicating an out-of-bound authentication sequence. In this case the user will be presented with a PIN that they need to enter into your application to complete the authorization flow.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM