2015-04-02 56 views
0

我爲node.js使用aws-sdk包,希望生成臨時憑證。爲什麼不使用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 

然而,當我退出了新的證書,它顯示undefinedaccessKeyId。我做錯了什麼嗎?

回答

1

AWS.TemporaryCredentials對象在您提出請求時會延遲刷新證書。如果你想手動刷新憑證,您可以撥打.refresh()上的憑據對象

AWS.config.credentials = new AWS.TemporaryCredentials(); AWS.config.credentials.refresh();

希望這有助於!

相關問題