开发者

Android -- Twitter Oauth -- Many different methods, none seem to work. Help

开发者 https://www.devze.com 2023-01-16 16:37 出处:网络
I can\'t get Oauth to work with Twitter. I have tried the following (all result in the same 401 error):

I can't get Oauth to work with Twitter. I have tried the following (all result in the same 401 error):

  1. jTwitter (using the default OauthSignpostClient)
  2. jTwitter using the commonshttp library (CommonsOauthProvider) instead of the "DefaultOauthProvider"
  3. jTwitter using the OauthScribeClient (instead of the OauthSignpostClient)
  4. oauth-signpost (by itself... no jTwitter)
  5. Twitter4J
  6. http://code.google.com/p/agirardello/
  7. http://dev.bostone.us/2009/07/16/android-oauth-twitter-updates/
  8. http://github.com/kaeppler/signpost-examples/blob/master/OAuthTwitterExample/src/TwitterMain.java

I've tried my own implementation and copy/pasted the sample code from each of the sites, and nothing seems to work. I'm also 100% sure I also downloaded and included any dependencies (where needed)开发者_如何学JAVA.

Here's the interesting part. Using jTwitter and the oauth-signpost library, I can initiate a connection to Twitter, open a browser window for the user, have them log-in and generate a PIN for my app. When the app goes to post a status update however, (using the pin, and the stored access token and token secret), the 401 error pops up. All other things I've tried won't even let me open a browser window and ask the user to generate a PIN (they die with the 401 error on the request for the "request token").

Please help. Thanks


I don't know if it will help you much with Android, but this post on Twitter OAuth by Chris Shiflett just came up on my interwebs.


First of all for OAuth you need to register your application with twitter I am assuming you have registered it. Now in case of desktop and mobile application you need request twitter for custom callback URL, as default callback url just works only for web apps. Once twitter approves requested call back URL , it will work .

But there is workaround, rather than OAuth request twitter for xAuth by submitting details of your applications. Then if twitter approves it , you can uses xAuth which works almost similar to OAuth.


Make sure your application had read&write access when you created it....

0

精彩评论

暂无评论...
验证码 换一张
取 消