你好我有困難使用JTwitter函數來驗證我的twitter應用程序。我總是得到一個「TwitterException」Android Jtwitter,身份驗證問題
這裏是我的方法
OAuthSignpostClient oauthClient = new OAuthSignpostClient(consumerKey,
privateKey, "oob");
一)我不知道「OOB」值應該是什麼,它是「callbackURL」在我的Twitter應用它說"callBack URL: none"
所以我試圖把"none"
,"None"
和null
其中"oob"
沒有不同的結果。
那麼剩下的就是樣板
Intent i = new Intent(Intent.ACTION_VIEW,
Uri.parse(oauthClient.authorizeUrl().toString()));
startActivity(i);
// get the pin
String v = oauthClient.askUser("Please enter the verification PIN from Twitter");
oauthClient.setAuthorizationCode(v);
// Store the authorisation token details for future use
String[] accessToken = oauthClient.getAccessToken();
// Next time we can use new OAuthSignpostClient(OAUTH_KEY, OAUTH_SECRET,
// accessToken[0], accessToken[1]) to avoid authenticating again.
EditText twitterText = (EditText)findViewById(R.id.twitterText);
twitterText.getText();
// Make a Twitter object
Twitter twitter = new Twitter(null, oauthClient);
// Print Daniel Winterstein's status
//System.out.println(twitter.getStatus("winterstein"));
// Set my status
twitter.setStatus(twitterText.getText());
在這一點上,我根本不知道如何使這項工作。希望我可以更詳細地瞭解它,但它與認證有關。我看到的在線事物沒有幫助
我只想補充一點,您需要在Twitter應用的設置標籤中設置回調網址(在twitter.com上)。它甚至不關心你在該領域投入什麼,但如果它是空的,回調網址將無法工作。這花了我大約一個小時才發現,所以我認爲這可能會讓別人節省一些時間。 –