tencentyun / wafer

Wafer - 快速构建具备弹性能力的微信小程序
https://github.com/tencentyun/wafer
Other
2.16k stars 333 forks source link

小程序中使用 cos-wx-sdk-v5 进行上传文件,SecretId 传不到sdk中的问题 #41

Open nick3108qqcom opened 6 years ago

nick3108qqcom commented 6 years ago

按照官网的例子写的,但是在sdk中并没有接受到SecretId

nick3108qqcom commented 6 years ago
var cos = new COS({
      getAuthorization: function (options, callback) {
        http.http(api.api.getImageSign, 'POST', {}).then(res => {
          var secretInfo = res.content;
          console.log(secretInfo)
          callback({
            SecretId: secretInfo.tmpSecretId,
            SecretKey: secretInfo.tmpSecretKey,
            XCosSecurityToken: secretInfo.sessionToken,
            ExpiredTime: secretInfo.expiredTime,
          });
        })
      },
    })