调用格式转换接口提示没有权限

Viewed 6

请求地址: https://solution.wps.cn/api/developer/v1/office/convert/to/pdf 请求参数: array:2 [
"url" => "https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/git.docx"
"filename" => "git"
]

返回参数: array:4 [ "code" => 10003 "message" => "PermissionDenied"
"hint" => "invalid Authorization"
"extra" => ""
]

2 Answers

invalid Authorization提示说明签名不正确,你可以用签名校验工具,单独验证加签对不对https://solution.wps.cn/docs/convert/overview.html#%E7%AD%BE%E5%90%8D%E7%AE%97%E6%B3%95 另外,注意请求参数filename需要给出正确的文件后缀,如:git.docx

签名校验工具在哪下载呢?

打开上述链接,可以看到签名生成表单,相同输入,校验对比签名输出,以此来检验与你的代码签名是否一致。

我们这边的签名在推送验证这块已经过了。存疑的地方是转换接口是post。我们再md5的时候,是将请求参数转换成了json再md5。问题点是不是出在这里

请求参数: "url" => "https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/git.docx" "filename" => "git.docx"

md5签名字符串

{"url":"https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/git.docx","filename":"git.docx"}

签名结果

"Content-Md5" => "c898665e551c0d38fd41d32d8907a844" "Content-Type" => "application/json" "DATE" => "Tue, 07 May 2024 01:59:42 GMT" "Authorization" => "WPS-2:SX20240425PTJHAM:11d893ec700ca87044a362f8192bf9531bb68e69"