Here's a simpler way, which works for me. import net.oauth.OAuth; import net.oauth.OAuthAccessor; import net.oauth.OAuthConsumer; import net.oauth.OAuthProblemException; import net.oauth.OAuthServiceProvider; import net.oauth.client.OAuthClient; import net.oauth.client.httpclient4.HttpClient4; import net.oauth.http.HttpMessage;
public class YahooContacts { private static final String consumerKey = ... private static final String consumerSecret = ... public static void main(String[] args) throws Exception { OAuthClient client = new OAuthClient(new HttpClient4()); OAuthAccessor accessor = new OAuthAccessor( new OAuthConsumer( null, consumerKey, consumerSecret, 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"))); final String callback = "oob"; try { client.getRequestToken(accessor, null, OAuth.newList(OAuth.OAUTH_CALLBACK, callback)); System.out.println(OAuth.addParameters( accessor.consumer.serviceProvider.userAuthorizationURL, OAuth.OAUTH_TOKEN, accessor.requestToken)); } catch (OAuthProblemException problem) { System.err.println(problem.getParameters().get( HttpMessage.RESPONSE)); } } } The imports are available via Maven: <dependency> <groupId>net.oauth.core</groupId> <artifactId>oauth</artifactId> <version>20090825</version> </dependency> <dependency> <groupId>net.oauth.core</groupId> <artifactId>oauth-httpclient4</artifactId> <version>20090617</version> </dependency> <repository> <id>oauth</id> <name>OAuth Repository</name> <url>http://oauth.googlecode.com/svn/code/maven</url> </repository> On Aug 25, 6:04 am, stager0909 <stager0...@gmail.com> wrote: > I want to use yahoo contact api. So I try oauth using HMAC-SHA1 > algorithm. But I fail to acquire request token. > result message : Unable to respond to any of these challenges: > {oauth=OAuth oauth_problem=signature_invalid} --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "OAuth" group. To post to this group, send email to oauth@googlegroups.com To unsubscribe from this group, send email to oauth+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/oauth?hl=en -~----------~----~----~----~------~----~------~--~---