my dog learned polymorphism
The moose likes Other Open Source Projects and the fly likes  I am using the OAUTH2.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark " I am using the OAUTH2.0" Watch " I am using the OAUTH2.0" New topic

I am using the OAUTH2.0

Gajendra Gaja

Joined: Jul 18, 2011
Posts: 1
Hi All,
I am using the OAUTH2.0 with below code,

OAuthServiceProvider provider = new OAuthServiceProvider(requestTokenURL, authorizationURL, accessTokenURL);
OAuthConsumer consumer = new OAuthConsumer("OAuth ", consumerKey, consumerSecret, provider);
OAuthAccessor accessor = new OAuthAccessor(consumer);
OAuthClient client = new OAuthClient(new HttpClient4());
List<Parameter> parameters = new ArrayList<OAuth.Parameter>();

parameters.add(new Parameter(ImsLtiLaunchParamDataKeys.OAUTH_CALLBACK, callBackUrl));
byte[] hash = DigestUtils.sha(IOUtils.toByteArray(new ByteArrayInputStream(body.getBytes())));
String b64 = new String(Base64.encodeBase64(hash),"UTF-8");

parameters.add(new Parameter(ImsLtiLaunchParamDataKeys.OAUTH_BODY_HASH, b64));
parameters.add(new Parameter("oauth_consumer_secret", consumerSecret));

OAuthMessage request = accessor.newRequestMessage(OAuthMessage.POST,requestTokenURL,parameters,new ByteArrayInputStream(body.getBytes()));

OAuthMessage msg =client.invoke(request, ParameterStyle.AUTHORIZATION_HEADER);

Our application getting following exception,

at net.oauth.client.OAuthResponseMessage.toOAuthProblemException(
Please any one can help me.
I agree. Here's the link:
subject: I am using the OAUTH2.0
jQuery in Action, 3rd edition