1
我已经使用Cognito SDK完成了许多获取/设置属性工作客户端,但现在我需要能够通过Lambda函数(在一个步骤函数中)从后端修改用户的自定义属性。管理来自Lambda的cognito用户属性 - 他们必须登录吗?
但是在进程的客户端版本中,有一个步骤我必须检索当前的Cognito用户,这是因为他们之前已经通过认证。这是代码:
var poolData = this.poolData;
var userPool = new AWSCognito.CognitoIdentityServiceProvider.CognitoUserPool(poolData);
var cognitoUser = userPool.getCurrentUser();
if (cognitoUser != null) {
cognitoUser.getSession(function(err, session) {
var attributeList = [];
var attribute = {
Name : attr,
Value : value
};
var attribute = new AWSCognito.CognitoIdentityServiceProvider.CognitoUserAttribute(attribute);
attributeList.push(attribute);
console.log("attributeList", attributeList);
cognitoUser.updateAttributes(attributeList, function(err, result) {
callback(err, result);
});
});
}
但在后端版本,我在技术上管理用户。
那么,我将如何修改lambda函数的用户属性数据?用户不一定先登录?
辉煌,感谢 – Kristian
Cognito开发这里,这是正确的答案。 –