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

Auth.js · Type Alias

NextAuthConfig

NextAuthConfig is the current Auth.js configuration type for Next.js. Use it to type a reusable configuration object, especially shared options that do not require an adapter.

How it works

NextAuthConfig is the configuration type used by Auth.js for shared options. In current Next.js integrations, export a configuration object that satisfies this type; keep it separate from the later NextAuth() call when the configuration must also work in environments such as middleware.

Syntax

type NextAuthConfig = Omit<AuthConfig, "raw"> | ((request: NextRequest | undefined) => Awaitable<Omit<AuthConfig, "raw">>)

Returns

A TypeScript configuration object type; it does not create an Auth.js instance.

Key points

  • In the current API, NextAuthConfig replaces the older NextAuthOptions type name.
  • Shared configuration is intended for common options that can operate without an adapter.
  • A provider list can be checked against NextAuthConfig with TypeScript’s satisfies operator.
  • The typed configuration object is separate from constructing the Auth.js instance.

Common mistakes

  • A configuration object typed with NextAuthConfig is not itself an initialized Auth.js instance; instantiate NextAuth separately when needed.
  • Keep adapter-dependent settings out of the shared configuration when it must be used in contexts where the adapter is unavailable.

Example: Shared Auth.js configuration

import GitHub from "next-auth/providers/github"
import type { NextAuthConfig } from "next-auth"

export default {
  providers: [GitHub],
} satisfies NextAuthConfig

Defines shared Auth.js configuration as a type-checked object without creating a NextAuth instance.

When to use it

Shared application configuration

Create a reusable auth.config.ts module containing providers and other adapter-independent options.

Edge-compatible configuration

Reuse common authentication settings in middleware or proxy code without loading database-specific adapter dependencies.

Interview questions

QWhat is NextAuthConfig?

NextAuthConfig is the current name for the configuration type previously called NextAuthOptions. It describes the options object passed to or used with the Next.js Auth.js integration.

Follow-up: Why separate an auth.config.ts file from auth.ts? A shared config can be reused in constrained environments, while the full instance can add adapter-dependent configuration.

QHow should a configuration object be typed?

Use a plain object and apply satisfies NextAuthConfig. This checks that the object conforms to the expected configuration shape while leaving the object as the value exported by the module.

Follow-up: What does satisfies avoid? It avoids turning the expression into a runtime Auth.js instance; it performs TypeScript compatibility checking only.

QWhat belongs in a shared NextAuthConfig object?

The shared object should contain common configuration that does not depend on the adapter, such as providers. Adapter and other environment-specific settings belong in the instantiated Auth.js setup when required.

Follow-up: What is the practical benefit? The same provider configuration can be imported by middleware or proxy code without importing database-specific dependencies.

  • AuthConfig
  • NextAuth
  • NextAuthOptions
  • Adapter

Source: Migrating to v5 - authjs.dev. Checked 2026-10-15.