[英]AWS Cognito - ConfigError: Missing region in config for JavaScript SDK
I am trying to call createIdentityPool from JavaScript SDK. 我正在尝试从JavaScript SDK调用createIdentityPool。 Please find the below code from sample html screen - 请从示例html屏幕中找到以下代码-
var cognitoidentity = new AWS.CognitoIdentity({apiVersion: '2014-06-30'});
AWS.config.apiVersions = {
cognitoidentity: '2014-06-30',
// other service API versions
};
var cognitoidentity = new AWS.CognitoIdentity();
AWS.config.region = 'us-east-1'; // Region
AWS.config.apiVersions = {
cognitoidentity: '2014-06-30',
// other service API versions
};
var params = {
AllowUnauthenticatedIdentities: true, // required
IdentityPoolName: 'String', // required
DeveloperProviderName: 'String',
OpenIdConnectProviderARNs: [
"my Pool Identity", // Identity Pool ID
],
};
cognitoidentity.createIdentityPool(params, function (err, data) {
if (err) alert(err, err.stack); // an error occurred
else alert(data); // successful response
});
Output alert is - 输出警报为 -
CredentialsError: Missing credentials in config CredentialsError:配置中缺少凭据
Can any one help me in this issue. 谁能在这个问题上帮助我。
Thanks, Rakesh. 谢谢,拉克什。
CreateIdentityPool must be called with your developer credentials. 必须使用您的开发人员凭据调用CreateIdentityPool。
You need to ensure that you have correctly initialized your SDK with AWS Credentials. 您需要确保已使用AWS Credentials正确初始化了SDK。 Credentials can be set globally on the AWS.config object or per service by passing the credential information to the service object directly. 通过将凭证信息直接传递到服务对象,可以在AWS.config对象或每个服务上全局设置凭证。
For more information on different ways to set credentials in your SDK, refer to: http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html 有关在SDK中设置凭据的不同方法的更多信息,请参阅: http : //docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.