【问题标题】:AsyncHttpClient box.com Access token not found未找到 AsyncHttpClient box.com 访问令牌
【发布时间】: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


    【解决方案1】:

    我设法通过删除我包含的 Content-MD5 标头来解决这个问题(我忘了在上面提到它)。不知何故,标题中的值设置不正确。

    【讨论】:

      猜你喜欢
      • 2014-01-22
      • 2021-09-22
      • 1970-01-01
      • 1970-01-01
      • 2015-11-22
      • 2021-02-18
      • 2020-08-06
      • 1970-01-01
      • 2016-07-16
      相关资源
      最近更新 更多