Configure the core Auth function
Core Auth setup
Auth.js · Type Alias
AuthConfig is the configuration type for Auth.js’s core Auth method. Use it to define authentication behavior and pass the resulting object to Auth or framework-specific initialization.
AuthConfig is the configuration type for the core Auth method. Use it to describe authentication providers and other behavior, then pass the configuration to Auth or use it as the basis for framework-specific setup.
type AuthConfig = { ... }import Auth, { type AuthConfig } from "@auth/core"
export const authConfig: AuthConfig = {
providers: [],
}
const request = new Request("https://example.com")
const response = await Auth(request, authConfig)Creates an AuthConfig object with no providers and passes it to the core Auth function.
Core Auth setup
Application initialization
Edge-compatible architecture
AuthConfig is the type used to configure the core Auth method. A configuration object can be passed to Auth, as shown in the core reference.
Follow-up: Why might configuration be split across files? A shared object can omit an adapter for edge-compatible usage, while the server-side Auth instance adds the adapter separately.
Define an object typed as AuthConfig and provide it to Auth. The core reference demonstrates importing the type from @auth/core and passing the object to Auth.
Follow-up: How can the same configuration be reused? Export the object and spread or pass it into framework-specific initialization where appropriate.
AuthConfig describes configuration rather than creating an Auth instance by itself. The installation documentation recommends an auth.ts configuration file where library behavior and custom authentication logic are specified.
Follow-up: What belongs in the initialization layer? Framework-specific handlers and exported helpers are created when the configuration is passed to the framework initializer.
AuthAuthConfigNextAuthConfigSvelteKitAuthConfigAuthHandler