I'm using AWS Amplify and I'm wondering is it best to store user attributes as custom Cognito attributes or in a user table for AppSync?
Cognito approach:
'username': 'jdoe',
'password': 'mysecurepassword#123',
'attributes': {
'email': 'me@domain.com',
'phone_number': '+12135555555',
'custom:favorite_flavor': 'Cookie Dough' // custom attribute, not standard
}
- Pros: Single source of truth
- Cons: Not part of the API
AppSync approach:
type User
@model
@auth(
rules: [
{allow: owner, ownerField: "owner", operations: [create, update, delete, read]},
])
{
id: ID!
owner: String
favoriteFlavor: String
}
- Pros: All the capabilities of the API
- Cons: Each person has two "users" (a Cognito user and a table user)
If the AppSync approach is best, should other fields carry over to the table (like the name or email)?
Thanks!