Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Auth.js · Type Alias

User

User is the Auth.js profile shape returned by an OAuth provider’s profile callback. Auth.js exposes it in JWT and session callbacks, and as the second session-callback parameter for database sessions.

How it works

The User type describes the profile object produced by an OAuth provider's profile callback. Auth.js exposes it to JWT and session callbacks, and supplies it as the second session-callback argument when database sessions are used.

Syntax

interface User {}

Returns

An interface describing an Auth.js user profile; it is not a callable function and therefore has no runtime return value.

Key points

  • User models the object produced by an OAuth provider's profile callback.
  • Auth.js makes User available inside both JWT and session callbacks.
  • With database sessions, User is supplied as the session callback's second parameter.

Common mistakes

  • The database-session callback receives User as its second argument; this differs from the JWT-session flow.

Example: User shape

interface User {
  id?: string
  name?: string | null
  email?: string | null
  image?: string | null
}

Define the optional profile fields returned by an OAuth provider and used by Auth.js callbacks.

When to use it

Type a provider profile result

An OAuth provider maps its provider profile into the common Auth.js user shape.

Handle JWT callback data

A JWT callback reads or enriches the authenticated profile.

Process database session context

A database-backed session callback uses the authenticated user alongside the session.

Interview questions

QWhere is the User type used?

User describes the object returned by an OAuth provider's profile callback. It is available in jwt and session callbacks, and is passed as the second session-callback argument when using a database.

Follow-up: How should application-specific fields be added? Use TypeScript module augmentation so the shared Auth.js interfaces remain consistent across submodules.

QWhat does User represent?

The type represents the provider-derived user profile rather than a database adapter contract. Its documented uses are the provider profile callback, jwt callback, session callback, and database-session callback argument.

Follow-up: What is the related adapter distinction? AdapterUser is the adapter-facing user type used for database operations, while User is the common application-facing profile shape.

QHow should code consume User safely?

Use the User shape when typing values returned from an OAuth provider's profile callback or consumed by Auth.js callbacks. Its fields are optional in the documented interface, so code should handle absent values.

Follow-up: Why are fields optional? Providers can omit profile attributes, so application code should not assume name, email, image, or id is always present.

  • DefaultUser
  • AdapterUser
  • Session
  • JWT

Source: Types. Checked 2026-10-15.