如标题中所述,是否可以更改Amazon Cognito用户的用户名?我在文档中找不到任何内容
可以preferred_username
通过updateAttributes
API调用使用iOS SDK更新Cognito用户的。不过,请注意,您将无法修改username
用户的。引用AWS官方文档,
用户名值是一个单独的属性,与名称属性不同。用户名始终是注册用户所必需的,创建用户后不能更改。
但是,preferred_username
确实可以更改该值,并且根据官方文档,使用iOS SDK更改示例用户名的示例代码如下:
AWSCognitoIdentityUserAttributeType * attribute = [AWSCognitoIdentityUserAttributeType new];
attribute.name = @"preferred_username";
attribute.value = @"John User";
[[user updateAttributes:@[attribute]] continueWithSuccessBlock:^id _Nullable(AWSTask<AWSCognitoIdentityUserUpdateAttributesResponse *> * _Nonnull task) {
//success
return nil;
}];
我还想指出,iOS SDK的AWS API文档非常少,我建议开发人员在有疑问时仔细阅读SDK源代码。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句