Skip to main content
Every Convex function has access to the calling user via ctx.auth.getUserIdentity(). Use it to scope reads and writes to the current user.

In a query

In a mutation

Same shape — get the identity, throw on missing, write scoped to the user.

In an action

Identical.

What’s in the identity

Common patterns

Built-in auth

The auth system overview.

Roles & permissions

Role-based access patterns.

Data access control

Security best practices.
Last modified on April 18, 2026