我正试图使用node.js库连接到(SP),遇到了一个非常奇怪的错误,似乎告诉我我不能承担自己的角色。
CustomError: User: arn:aws:iam::11111:user/bob is not authorized to perform: sts:AssumeRole on resource: arn:aws:iam::11111:user/bob我对AWS相当陌生,但我非常肯定,这个面向用户的内联策略应该足以满足我所要做的工作,我甚至已经让它在所有资源上都能工作,而不仅仅是我以前创建的SellingPartners角色:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": "sts:AssumeRole",
"Resource": "*"
}
]
}以下是我的完整代码,以防有帮助:
const SellingPartnerAPI = require('amazon-sp-api');
(async() => {
try {
let sellingPartner = new SellingPartnerAPI({
region:'na', // The region to use for the SP-API endpoints ("eu", "na" or "fe")
refresh_token:'xxxxxx', // The refresh token of your app user
credentials:{
SELLING_PARTNER_APP_CLIENT_ID:'xxxxx',
SELLING_PARTNER_APP_CLIENT_SECRET:'xxxxx',
AWS_ACCESS_KEY_ID:'xxxx',
AWS_SECRET_ACCESS_KEY:'xxxxx',
AWS_SELLING_PARTNER_ROLE:'arn:aws:iam::11111:user/bob'
}
});
let res = await sellingPartner.callAPI({
operation:'getOrders',
endpoint:'orders'
});
console.log(res);
} catch(e) {
console.log(e);
}
})();发布于 2021-06-22 13:29:25
ARN arn:aws:iam::11111:user/bob描述的是用户,而不是角色。
如果客户端需要一个角色ARN,那么它可能应该类似于arn:aws:iam::11111:role/your-role-name。
https://stackoverflow.com/questions/68080059
复制相似问题