我正在使用node {js的aws-sdk包,并希望生成临时凭证。
我有:
AWS.Config.credentials = new AWS.Credentials 'myKey', 'mySecret'
console.log AWS.Config.credentials
AWS.config.credentials = new AWS.TemporaryCredentials()
# DurationSeconds: 1200
console.log '===='
console.log AWS.config.credentials
但是,当我注销新凭据时,它会显示undefined
的{{1}}。我做错了吗?
答案 0 :(得分:1)
AWS.TemporaryCredentials
对象在您发出请求时会懒洋洋地刷新凭据。如果要手动刷新凭据,可以在凭证对象
.refresh()
AWS.config.credentials = new AWS.TemporaryCredentials();
AWS.config.credentials.refresh();
希望这有帮助!