次のスニペットがあります。
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' }
公式ドキュメントに従ってIAM ユーザー、IAM ポリシー、IAM ロールを作成し、この Node.js スクリプトをセットアップしただけなので、失敗する理由がわかりません。
特定の ASIN のメタデータを取得したいのですが、今のところ、末尾がAccessDenied
.
どうすればこれを解決できますか?