我的問題是我試圖從雅虎獲取請求令牌時出現錯誤。該錯誤說我缺少oauth_callback參數,是的,我錯過了,因爲我不需要它。我讀過,如果我不想使用它(桌面應用程序),我需要將它設置爲「oob」值。我這樣做,但無濟於事。如果我將它設置爲null,則會發生同樣的情況。即時通訊使用OAuth的Java:http://oauth.googlecode.com/svn/code/java/core/OAuth java實現,oauth_callback丟失
OAuthServiceProvider serviceProvider = new OAuthServiceProvider("https://api.login.yahoo.com/oauth/v2/get_request_token",
"https://api.login.yahoo.com/oauth/v2/request_auth",
"https://api.login.yahoo.com/oauth/v2/get_token");
OAuthConsumer consumer = new OAuthConsumer("oob", consumerKey, consumerSecret, serviceProvider);
OAuthAccessor accessor = new OAuthAccessor(consumer);
OAuthClient client = new OAuthClient(new HttpClient4());
OAuthMessage response = client.getRequestTokenResponse(accessor, OAuthMessage.POST, null);
System.out.println(response.getBodyAsStream());