title: Should I use AWS Cognito "username" or "sub" (uid) for storing in database?
body: <p>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 "sub" (it's his uid)? All Amazon API functions like <a href="http://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_AdminGetUser.html" rel="noreferrer">AdminGetUser</a> are using "username" parameter, but not sub/uid.</p>
  
  <p>But I also read that <a href="https://mobile.awsblog.com/post/Tx3JK25U7Z9EUIU/Integrating-Amazon-Cognito-User-Pools-with-API-Gateway" rel="noreferrer">article</a> and the author said "Always generate the policy on value of 'sub' claim and not for 'username' because username is reassignable. Sub is UUID for a user which is never reassigned to another user." </p>
  
  <p>So, now I'm hesitating what I have to use as unique user identifier - "username" or "sub"</p>
  
  <p>Thank you.</p>