【发布时间】:2013-08-31 04:10:43
【问题描述】:
我试图在 box.com 上上传一个文本文件。我正在使用 Android 异步 Http 客户端。我更喜欢使用它,因为它更干净。 Box.com 文件上传说明:http://developers.box.com/docs/#files-upload-a-file.
我试过了,总是得到未找到访问令牌的错误。我不喜欢使用 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."}
【问题讨论】:
标签: android box-api android-async-http