I am currently working on a system with an authorization server and multiple resource servers. Each resource server handles different types of data and operations.
I am trying to decide on the best practice for managing user information across these resource servers. Specifically, I am unsure whether I should store both the user ID and the email address on each resource server or just the user ID.
Here are some considerations:
User ID Only:
Pros: Simplifies data storage and reduces redundancy.
Cons: If I need to filter or paginate data based on the email address, I would have to join with another table or make an additional call to retrieve email information.
User ID and Email:
Pros: Simplifies operations like filtering and pagination within the resource server, as email is directly available.
Cons: Introduces redundancy and potential data inconsistency if the email changes and is not updated across all resource servers.
Given these points, what is the best practice in this scenario? Should I store a reference to both the user ID and email in all resource servers, or should I stick to just the user ID and manage email information separately? How do I handle scenarios where I need to filter or paginate based on the email address efficiently?
Any advice or best practice recommendations would be greatly appreciated!