AWSCognito登录提供程序错误

时间:2015-08-13 02:39:47

标签: amazon-web-services aws-sdk amazon-cognito

所以我说它有点慢,根据它所说的文件

"Logins - A map of logins for this identity. As with GetId and 
GetOpenIdToken, you can supply any supported public
 provider token, but you can additionally supply a user 
identifier keyed by the developer provider name that 
you set when you created the identity pool.This should be 
a unique identifier for this user in your system."

我在创建身份池时已添加了登录提供程序,但在访问AWS Cognito时出现此错误。

"InvalidParameterException: Please specify at least one login provider"

我的登录提供商是问题吗?登录提供程序密钥与我在创建IdentityPool时添加的密钥匹配

var params = {
   IdentityPoolId: 'us-east-1:2e90e469-c81a-4936-b78a-7071e79b3032', /* required */
   Logins: { /* required */
   "login.appName.myapp": 'userIdentifier',
   /* anotherKey: ... */
},
  IdentityId: null,
  TokenDuration: 1
};

" login.appName.myapp"的值是一个独特的生成字符串,我认为应该没问题。

------------------------ UPDATE ------------------- ---

var cognitoidentity = new AWS.CognitoIdentity();

var params = {
 IdentityPoolId:'us-east-1:2e90e469-c81a-4936-b78a-7071e79b3032',
 Logins: {

 },
 IdentityId: null,
 TokenDuration: 1
};
 cognitoidentity.getOpenIdTokenForDeveloperIdentity(params, function(err, data) {
 if (err) console.log(err, err.stack); // an error occurred
 else     console.log(data);           // successful response
});

我一直在使用这个aws文档作为参考:http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/CognitoIdentity.html#getOpenIdTokenForDeveloperIdentity-property

1 个答案:

答案 0 :(得分:1)

假设您使用JavaScript SDK进行此调用,请尝试使用代码Bob provided in his recent answer

<强>更新 在上面更新的代码示例中传递给getOpenIdTokenForDeveloperIdentity的Logins映射中,您需要添加键和值。密钥应该是您在身份池控制台中添加的开发人员提供程序的名称。该值应该是您用于唯一标识用户的标识符(您选择的任何唯一标识符,例如用户标识或电子邮件地址)。