我的问题是我在尝试从 Yahoo 获取请求令牌时出错。错误说我缺少 oauth_callback 参数,是的,我想念它,因为我不需要它。我读过如果我不想使用它(桌面应用程序),我需要将它设置为“oob”值。我这样做了,但无济于事。如果我将它设置为 null 也会发生同样的情况。我为 java 使用 OAuth:http: //oauth.googlecode.com/svn/code/java/core/
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());