私有空间下载URL包错信息:
"error": "download token auth failed" 跟着官方的用例走的,公有空间没问题,就是私有空间有问题!
测试代码如下:
try {
String fileName = "c7312840410401.577e3426c888a.jpg";
String domainOfBucket = "******.bkt.clouddn.com";
String encodedFileName = URLEncoder.encode(fileName, "utf-8");
String publicUrl = String.format("%s/%s", domainOfBucket, encodedFileName);
String accessKey = qiniuProperties.getAccessKey();
String secretKey = qiniuProperties.getSecretKey();
Auth auth = Auth.create(accessKey, secretKey);
// long expireInSeconds = 3600;//1小时,可以自定义链接过期时间
String finalUrl = auth.privateDownloadUrl(publicUrl);
System.out.println("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
System.out.println(finalUrl);
System.out.println(System.currentTimeMillis());
System.out.println("******************************");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
系统时间没问题,啊啊啊啊啊啊!!!!
这个就是私有空间鉴权凭证签算有问题吧,可以直接用demo试试看