File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

I am using the OAUTH2.0

 
Gajendra Gaja
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
[javadoc]
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(OAuthResponseMessage.java:83)
Please any one can help me.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic