2013-08-31 2 views
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."} 

답변

0

내가 포함 된 Content-MD5 헤더를 제거하여이 문제를 해결할 수있었습니다 (위에 언급 한 것을 잊어 버렸습니다). 어떻게 든 헤더의 값은 올바르게 설정되지 않습니다.

관련 문제