Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String oauthToken = urls[0];
- String tokenVerifier = urls[1];
- String responseBody = null;
- try {
- String url = "https://api.copy.com/oauth/access?oauth_verifier=" + tokenVerifier;
- 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"",
- Constants.COPY_CONSUMER_KEY,
- oauthToken,
- Constants.COPY_SECRET, tokenVerifier,
- String.valueOf((int) (Math.random() * 100000000)),
- String.valueOf(Calendar.getInstance().getTimeInMillis()));
- Map<String, String> headers = new HashMap<String, String>();
- headers.put("Authorization",authorization);
- HttpClient httpclient = new DefaultHttpClient();
- HttpGet httppost = new HttpGet(url);
- httppost.setHeader("Authorization", authorization);
- ResponseHandler<String> responseHandler = new BasicResponseHandler();
- responseBody = httpclient.execute(httppost, responseHandler);
- 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