收藏
回答

三方平台调用上传云函数接口报:AuthFailure.SignatureFailure?

按照三方平台的流程,分别获取了代码保护秘钥,上传凭证等,然后通过上传凭证返回的数据来作为上传云函数的 header 头。

上传凭证加密加密前的body为:

{"CodeSecret":"w6iTPMKVNg0/pRh6aFN4EZknxlFaN319xqLfNJ28y96U8AYlJbwXx17AOWcnozbh","EnvId":"tuya-service","FunctionName":"ty-service","Handler":"index.main","ZipFile":"UEsDBBQACAAIAPCbflEAAAAAAAAAAFIAAAAIACAAaW5kZXguanNVVA0ABxTYxF8V2MRfFNjEX3V4CwABBPUBAAAEFAAAAEutKMgvKinWy03MzFOwVdBILUvNK9FRSM7PK0mtKNFUsLVTqOZSAIKi1JLSojwoBwSUMlJzcvKVrGAMsEQtVy0AUEsHCM8aoTVBAAAAUgAAAFBLAQIUAxQACAAIAPCbflHPGqE1QQAAAFIAAAAIACAAAAAAAAAAAACkgQAAAABpbmRleC5qc1VUDQAHFNjEXxXYxF8U2MRfdXgLAAEE9QEAAAQUAAAAUEsFBgAAAAABAAEAVgAAAJcAAAAAAA=="}

通过示例代码加密后得到:3b2467479f14183e2283de34162a6937bedc15112e66c4f816c79e1c80cb7260

然后调用接口:https://api.weixin.qq.com/tcb/getuploadsignature?access_token=ACCESS_TOKEN

返回的 headers: Authorization:TC3-HMAC-SHA256 Credential=AKIDvLgTF6uPpeGfZbHhy2REaJ1X8Y1rO_ZcZS_5_z5nVqK0ByZzqLe5mTNZ8S2xakp7/2020-11-30/scf/tc3_request, SignedHeaders=content-type;host, Signature=d7a53af851e1ae89317f657e975b27de09ab2f72aa4329a31d590d641598d781\r\nHost:scf.tencentcloudapi.com\r\nContent-Type:application/json\r\nX-TC-Action:UpdateFunctionCode\r\nX-TC-Timestamp:1606736498\r\nX-TC-Version:2018-04-16\r\nX-TC-Region:ap-shanghai\r\nX-TC-Token:0Me0Sx5FF0C0L6aFrapeHiRz541Tm02aa3b0b23005779e74f0e50374c0c5db055Lc-TR7MuXa_aki5V-lyukhs7vvhxZai4wTPv0ZT3cNxjlkbc39dYmRMuNg7GkY6EqFgmAaqck3Og9wFjTtUX6Igvfgaje6nrK9vJ-pNMeJj2snwMSfBSnBjzGmZXaMN5X47AevhEBITgwiPjhSLeXXyQEsh2IRrrnM2K-4Ftz70dmeH8srVmhFyCqZywlyX-w_1RpHfQ6caVJ43_q-343VG8iYFEFBbpb3OaRPJ56usk1K9JRvSK6ewwTq398Lqcc40MYbQi8N1J0vpGiQY4nXU-kbaAhjGzPDxtnUl7A1ufse_cpOdl4y1y2RgBi0m7CGfrYV_gUkePJ77bvCaTeoeZL6l3UrB5Q-Cdu5jsQQ

但是把返回的 headers 和 body 调用上传云函数的接口,返回的却是:

{

"Response": {

"Error": {

"Code": "AuthFailure.SignatureExpire",

"Message": "The signature is expired, please request again."

},

"RequestId": "f9be6f52-205c-43a2-877c-cf47faf7689a"

}

}

麻烦尽快看一下

回答关注问题邀请回答
收藏
登录 后发表内容
问题标签