Advertisement
Guest User

Untitled

a guest
Mar 3rd, 2015
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. String oauthToken = urls[0];
  2. String tokenVerifier = urls[1];
  3. String responseBody = null;
  4.  
  5. try {
  6. String url = "https://api.copy.com/oauth/access?oauth_verifier=" + tokenVerifier;
  7.  
  8. String authorization = String.format("OAuth oauth_version="1.0", oauth_signature_method="HMAC-SHA1", oauth_consumer_key="%s", oauth_token="%s", oauth_signature="%s&%s", oauth_nonce="%s", oauth_timestamp="%s"",
  9. Constants.COPY_CONSUMER_KEY,
  10. oauthToken,
  11. Constants.COPY_SECRET, tokenVerifier,
  12. String.valueOf((int) (Math.random() * 100000000)),
  13. String.valueOf(Calendar.getInstance().getTimeInMillis()));
  14.  
  15. Map<String, String> headers = new HashMap<String, String>();
  16. headers.put("Authorization",authorization);
  17.  
  18. HttpClient httpclient = new DefaultHttpClient();
  19. HttpGet httppost = new HttpGet(url);
  20. httppost.setHeader("Authorization", authorization);
  21.  
  22. ResponseHandler<String> responseHandler = new BasicResponseHandler();
  23. responseBody = httpclient.execute(httppost, responseHandler);
  24.  
  25. oauth_problem=signature_invalid&debug_sbs=GET&https%3A%2F%2Fapi.copy.com%2Foauth%2Faccess&oauth_consumer_key%3DCtu6CtdN1PWRo5DstoxgaaIQWZkeeWNg%26oauth_nonce%3D10525625%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1425400347545%26oauth_token%3D6aNkypb7wZoI7dbJiSrtItOTGmpaG0RL%26oauth_verifier%3D496cb46091352c4788603dcfb6e0cfb5%26oauth_version%3D1.0oauth_error_code=2000
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement