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

后端 未结 4 1427
悲哀的现实
悲哀的现实 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:38

    If you only want to store one, the sub is probably the way to go for the reasons you provided.

    It depends greatly on your use case, but if you need to use this database to call APIs like your example, keeping track of both/a mapping between the two is a totally valid solution.

提交回复
热议问题