【发布时间】:2015-11-05 17:03:58
【问题描述】:
我在后端使用aws-sdk javascript,可以正常使用AWS,但是当我尝试使用getOpenIdTokenForDeveloperIdentity 方法时,我得到"Missing region in config error" 作为响应。
var config = new AWS.Config({
accessKeyId: "MYACCESSKEY", secretAccessKey: "MYSECRETYKEY", region: 'us-east-1'
});
var params = {
IdentityPoolId: 'MYIDENTITYPOOLID', /* required */
Logins: { /* required */
"login.my.myapp": 'string',
/* anotherKey: ... */
},
IdentityId: null,
TokenDuration: 0
};
cognitoidentity.getOpenIdTokenForDeveloperIdentity(params,function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
在文档中它说:
默认情况下,凭据和区域设置未配置。这应该由应用程序在使用任何 AWS 服务 API 之前进行配置。
所以我设置了我的地区,但为什么我仍然收到错误?
【问题讨论】:
标签: amazon-web-services aws-sdk amazon-cognito