Tumblr post reblog api を呼び出すと 401 ステータスが表示され、他の tumblr api は正常に動作しています。
私はいくつかの Stackoverflow リンクをたどりましたが、それに乗れません。
tumblrブログに投稿しようとすると、常に401を取得します
tumblr-oauth-image-post-gives-me-401-invalid-oauth-credentials
私のコードスニペット:
String url = String.format(REBLOG_URL, blogName);
HttpPost request = new HttpPost(url);
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("id", postId));
nameValuePairs.add(new BasicNameValuePair("reblog_key", reblogKey));
nameValuePairs.add(new BasicNameValuePair("comment", comment));
nameValuePairs.add(new BasicNameValuePair("api_key", consumerKey));
request.setEntity(new UrlEncodedFormEntity(nameValuePairs, "UTF-8"));
CommonsHttpOAuthConsumer consumer = new CommonsHttpOAuthConsumer(consumerKey, secretKey);
consumer.setTokenWithSecret(mDataStore.getAccessToken(mUserSequenceId),
mDataStore.getTokenSecret(mUserSequenceId));
consumer.sign(request);
String response = makePostRequest(request);
L.d(TAG, "postReblog Response : " + response);
エラー出力:
10-21 21:48:31.851: W/DefaultRequestDirector(30729):
Authentication error: Unable to respond to any of these challenges: {}
10-21 21:48:31.851: D/PhotoAPI(30729): post response code:401 10-21
21:48:31.861: D/PhotoAPI(30729): Post response :
{"meta":{"status":401,"msg":"Not Authorized"},"response":[]}
前もって感謝します。