Users & identities

A step of the Cloud application tree on Gradus, in the Data & storage area: DB, cache, queues.

Store a person once: a users record with its own stable id and a separate identities record, so a password, Google and GitHub can all attach to one user.

Usually comes after: Transactional email.

Leads to: Choose how users sign in.

Prompt for your AI assistant

Read the database decision record in docs/decisions and the data access layer. Add two records through that layer, as a migration or a document model and indexes, whichever this database uses: a user with its own generated id, display name, timestamps and deletion state, and an identity that links a user to a sign-in method by provider and the provider's subject, unique together, with the address and whether it was verified as that provider reported them. Use the user's own id everywhere else in the data, never an address or a provider's id, so an address can change and a provider can be replaced. Store no passwords or tokens yet. Add tests and document the model in docs/.

This is https://gradus.kazet.blog/tree/cloud-application/step/users-and-identities as plain HTML. In a browser the page also lets you mark the step forged and copy a message for your AI assistant.