1
我試圖在box.com上傳文本文件。我正在使用Android異步Http客戶端。我更喜歡使用它,因爲它更乾淨。 Box.com文件上傳說明在這裏:http://developers.box.com/docs/#files-upload-a-file。AsyncHttpClient box.com未找到訪問令牌
我試過並總是得到訪問令牌未找到的錯誤。我不喜歡使用android box.com sdk。
File myFile = new File(path_to_file + "test.txt"));
RequestParams params = new RequestParams();
params.put("filename", "test.txt");
params.put("parent_id", "0");
AsyncHttpClient client = new AsyncHttpClient();
client.addHeader("Authorization", "Bearer " + "TOKEN");
client.post("https://upload.box.com/api/2.0/files/content", params, new AsyncHttpResponseHandler() {
@Override
public void onSuccess(String response) {
System.out.println(response);
}
});
Authentication error: Unable to respond to any of these challenges: {bearer=WWW- Authenticate: Bearer realm="Service", error="invalid_request", error_description="The access token was not found."}