使用Java将照片上载到flickr时签名无效

使用Java将照片上载到flickr时签名无效,java,api,upload,photo,flickr,Java,Api,Upload,Photo,Flickr,使用Flickr API- 当我试图上传一张照片时,它给了我错误96:签名无效 这是我的代码: String sig = secret + "api_key" + key + "auth_token" + token; String signature = FlickrRequestFrob.MD5(sig); String request = "http://api.flickr.com/services/upload/"; HttpClient clien

使用Flickr API- 当我试图上传一张照片时,它给了我错误96:签名无效

这是我的代码:

    String sig = secret + "api_key" + key + "auth_token" + token;
    String signature = FlickrRequestFrob.MD5(sig);

    String request = "http://api.flickr.com/services/upload/";

    HttpClient client = new HttpClient();
    PostMethod postMethod = new PostMethod(request);
    //System.out.println("Api Sig" + signature);
    postMethod.addParameter("api_key",key);
    postMethod.addParameter("api_sig", signature);
    postMethod.addParameter("auth_token", token);
    postMethod.addParameter("is_public", "1");
    postMethod.addParameter("photo", "C:/DSC_0281.JPG");
    postMethod.addParameter("title", "Scary!");

    int status = client.executeMethod(postMethod);
    System.out.println("Status: " + status);

    InputStream responseStream = postMethod.getResponseBodyAsStream();
答复是:

现状:200 答复:

<?xml version="1.0" encoding="utf-8" standalone="no"?><rsp stat="fail">
    <err code="96" msg="Invalid signature"/>
</rsp>


我不知道为什么,有人可以帮我吗?

需要为整个参数列表进行md5签名,而不仅仅是密钥和令牌

因此,简而言之:创建一个完整的排序参数列表(不带“=”字符),并对其进行md5哈希。这应该行得通

详见第(8)章