【发布时间】:2020-08-18 16:32:29
【问题描述】:
我想使用 AWS Cognito 创建 2 个不同的用户,例如“basicUser”和“admin”。目前,我能够使用 AWS Amplify 创建 basicUser,基本上使用 AWS Cognito。
在 AWS Amplify 的文档中写道,我可以在将保存的用户对象中插入自定义属性。 AWS Amplify 示例报告:
const user = await Auth.signUp({
username,
password,
attributes: {
email, // optional
phone_number, // optional - E.164 number convention
// other custom attributes
}
});
AWS Amplify 文档:https://docs.amplify.aws/lib/auth/emailpassword/q/platform/js#sign-up
使用属性角色是一个很好的解决方案,它是一个用户可以拥有的角色数组?这将使用引用此文档的 Cognito API 在代码端完成[应用程序的所有者将负责确认来自用户的“管理员请求”]:
这种方法是一种不好的做法,我可以做得更好还是一个好的解决方案?
提前致谢。
【问题讨论】:
标签: amazon-web-services amazon-cognito aws-amplify