検証に Oauth を使用しようとしています。私のコード例は次のとおりです。
ArrayList <NameValuePair> params = new ArrayList<NameValuePair>();
boolean flag=false;
URL url;
String oauth_nonce="q14F5ApN4Ka5RJGbYgabXwMSZ4BxVrlNGedN9zoFAoi3rc7dpLjIgri1erAAriPu";
String oauth_timestamp="1336069726";
String signatureString =
URLEncoder.encode("device_id=id_here")
+URLEncoder.encode("&device_type=psw_here")
+URLEncoder.encode("&oauth_consumer_key=consumer_key_here...&oauth_nonce=" +
oauth_nonce+
"&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1336069726&oauth_version=1.0");
String percent_encoded_url = URLEncoder.encode("http://www.example.com");
String signatureBaseString = "POST"+
"&"+percent_encoded_url+
"&"+signatureString;
String oauth_signature=URLEncoder.encode(computeHmac(signatureBaseString, "aWAQTWR7VvHapaNhWBCL0VaUdGN2xzN4&"));
String headerValue ="OAuth "+
"oauth_consumer_key=\""+"consumer_key_here..."+"\","+
"oauth_signature_method=\"HMAC-SHA1"+"\","+
"oauth_signature=\""+oauth_signature+"\","+
"oauth_timestamp=\"1336069726"+"\","+
"oauth_nonce=\""+oauth_nonce+"\"," +
"oauth_version=\"1.0"+"\"";
HttpPost httppost = new HttpPost("http://www.example.com/");
httppost.setHeader("Content-Type","application/x-www-form-urlencoded");
httppost.setHeader("Authorization",headerValue);
HttpEntity httpentity = new UrlEncodedFormEntity(params);
HttpClient httpclient = new DefaultHttpClient(clientConnectionManager, httpparams);
StringBuilder sb = new StringBuilder();
try {
HttpResponse response = httpclient.execute(httppost);
リクエストを送信すると、常に「Bad Signature Match」と表示されます。Oauth についての知識はありません。どこが間違っているのかわかりません。誰かが私を正しい方向に導くことができますか?