【发布时间】:2021-08-20 18:36:01
【问题描述】:
我正在尝试使用预签名 URL 获取 pdf 文件以进行电子签名。我使用 Amplify Storage 生成 URL。然后我向 HelloSign 函数提供 URL,以将文件带入嵌入窗口。我可以使用window.open 打开文档,但这种其他方法会带来SignatureDoesNotMatchThe request signature we calculated does not match the signature you provided. 错误。
The request signature we calculated does not match the signature you provided. Check your key and signing method.
key: string = 'bucketname/path/to/file.pdf'
expires: number = 60
const url = await Storage.get(key, {
level: 'public',
cacheControl: 'no-cache',
signatureVersion: 'v4',
ContentType: 'application/pdf',
expires: 60,
customPrefix: {
public: '',
protected: '',
private: '',
},
})
hellosign.open(url, {
clientId,
skipDomainVerification: true,
})
我在 Github 上找到的一个修复方法是在使用 SDK 初始化 S3 类实例时包含 signatureVersion。但是我没有使用 SDK,所以我尝试在配置 Amplify 时提供它:
AWSS3: {
bucket,
region,
signatureVersion: 'v4',
},
不用说它没有解决问题。我在文档中找不到对此的任何引用,因为 Amplify.configure 函数在他们的文档中使用了 any。
我尝试单击预签名的 URL,并且能够毫无问题地下载文档。我检查了请求并看到了与来自hellosign.open 的传出请求相匹配的正确标头。有什么我可以尝试的想法吗?
【问题讨论】:
标签: amazon-s3 aws-amplify hellosign-api