更新时间:2021-10-20 22:28:10
问题是,您对API调用使用了无效的参数-SDK不知道如何处理 region
, accessKeyId
和 secretAccessKey
:
The problem is, that you used invalid Parameters to your API calls - the SDK doesn't know what to do with region
, accessKeyId
and secretAccessKey
:
const params = {
Bucket: 'asdasd',
region: 'asadas1', // Here,
accessKeyId: 'SADIYIUYSADSA8768GHSAD', // here
secretAccessKey: 'sdas+sadJSADH7', // and here
}
请参阅 listObjects API文档供参考.
很明显,您的SDK的设置方式不正确,请参见有关操作方法的文档.
Apparently your SDK isn't set up in the correct way, please see the documentation on how to do that.
注意:如果您使用的是诸如Angular之类的客户端JS框架,则对安全凭证进行硬编码是一个糟糕的主意!您的用户将能够看到这些内容并使用它们来访问其他资源.我上面链接的文档为您提供了更好的选择.
如果您想忽略***实践,您绝对不应该,那么您可以通过以下方式做到这一点:
If you want to ignore Best Practices, which you absolutely shouldn't, this is how you could do it: