検索

ホームページ  >  に質問  >  本文

node.js - 七牛 saveas 401 error: "verify the sign failed"

拼接完整链接后再程序里面访问401,在浏览器访问正常

// qiniu saveas
QN.prototype.saveas = function ( bucketname, key, saveBucketname, saveKey, param ) {
  const self = this;

  let url = this.getUrl(bucketname, key) + param;
  const entryUri        = saveBucketname + ':' + saveKey;
  const encodedEntryURI = qiniu.util.urlsafeBase64Encode(entryUri);
  url += '|saveas/' + encodedEntryURI;
  const sign = qiniu.util
  .hmacSha1(url.replace('http://', ''), this._qiniu.conf.SECRET_KEY);
  const encodedSign = qiniu.util.base64ToUrlSafe(sign);
  url += '/sign/' + this._qiniu.conf.ACCESS_KEY + ':' + encodedSign;
  console.log(url);

  //这里请求401报错
  return http.get(url, function () {
    console.log(arguments);
  });

};

报错信息:

error: "verify the sign failed"

想请教这是什么原因,是请求头的问题吗?

天蓬老师天蓬老师2779日前736

全員に返信(0)返信します

応答なし
  • キャンセル返事