Im building a serverless backend using AWS Cognito for user administration.
Cognito uses both cognitoId
and sub
to identify a user.
This project from the official awslabs uses the cognitoId as primary key in the database tables to link data to a user object, but the documentation about sub
clearly states:
sub
: the UUID of the authenticated user. This is not the same asusername
.
Question: What should I use as primary key, cognitoID
or sub
?