我有以下代码片段:
const SellingPartnerAPI = require('amazon-sp-api');
process.env.SELLING_PARTNER_APP_CLIENT_ID = "..."
process.env.SELLING_PARTNER_APP_CLIENT_SECRET = "..."
process.env.AWS_ACCESS_KEY_ID = "..."
process.env.AWS_SECRET_ACCESS_KEY = "..."
process.env.AWS_SELLING_PARTNER_ROLE = "SellingPartnerAPIRole"
const TOKEN = '...';
(async () => {
try {
let sellingPartner = new SellingPartnerAPI({
region: "eu",
refresh_token: TOKEN
});
let res = await sellingPartner.callAPI({
operation:'getCompetitivePricing',
endpoint:'productPricing'
});
console.log(res);
} catch (e) {
console.error(e)
}
})()它的失败如下所示:
{ code: 'AccessDenied',
message:
'User: arn:aws:iam::7xxxx9:user/XXX is not authorized to
perform: sts:AssumeRole on resource: SellingPartnerAPIRole',
type: 'error' }我不明白为什么它会失败,因为我只是按照official docs创建了IAM user、IAM Policy、IAM角色,然后设置了这个Node.js脚本。
我想要获取给定ASIN元数据,但现在它只是以AccessDenied结束。
我该如何解决这个问题呢?
发布于 2021-09-19 19:13:09
如果iam用户有sts策略,它可能应该是arn:aws:iam::99999:role/role-name。
process.env.AWS_SELLING_PARTNER_ROLE = "arn:aws:iam::99999:role/role-name"https://stackoverflow.com/questions/69072192
复制相似问题