[oauth] Re: invalid sinature problem

2009-08-26 Thread John Kristian

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
  groupIdnet.oauth.core/groupId
  artifactIdoauth/artifactId
  version20090825/version
/dependency
dependency
  groupIdnet.oauth.core/groupId
  artifactIdoauth-httpclient4/artifactId
  version20090617/version
/dependency

repository
  idoauth/id
  nameOAuth Repository/name
  urlhttp://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
-~--~~~~--~~--~--~---



[oauth] Re: how to use erlang-oauth

2009-08-26 Thread pablo

I've looked at the couchdb code and it seems they copied part of
erlang-oauth
inseatd of using it as an app so it's hard to use it as an example.

If there is no better example I'll have to implement something simple
myself.

Thank you

On Aug 14, 1:21 pm, Tim Fletcher t...@tfletcher.com wrote:
  Can someone please show me how to start with this erlang lib

 There is an example mochiweb server 
 athttp://github.com/tim/erlang-oauth-examples,
 but that doesn't do things properly, i.e., you'd have to write quite
 a bit more code to make that into something you could use in a
 production website.

 Recently, Jason Davies integrated erlang-oauth with CouchDB (http://
 couchdb.apache.org/), so that would be a more realistic example.

  How do I generate the website Secret and how do I generate
  a Salt for users?

 However you like. If you want something unpredictable then i would
 suggest taking a look at the Erlang crypto library (http://erlang.org/
 doc/apps/crypto/), which can be used to generate random bytes.

 Hope that helps a bit.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---