Should I use AWS Cognito “username” or “sub” (uid) for storing in database?

后端 未结 4 1428
悲哀的现实
悲哀的现实 2021-01-31 03:59

I have an authenticated user in AWS Cognito service and want to store his unique identifier in the database. Should I store user\'s username (it\'s his phone number) or his \"su

4条回答
  •  梦如初夏
    2021-01-31 04:29

    One of the current limitations (to this date) of Cognito is listing users, if you save the sub in your own database for identify your users, and later you try to recover information of this saved user from cognito is not possible, due aws doesn't allow filter by sub or custom attributes, so use username for saving an uuid and prefered_username as alias for real username.

    In javascript AWS.CognitoIdentityServiceProvider.ListUser, same for others.

提交回复
热议问题