API Reference

NextAuth v5

export const { auth, handlers } = NextAuth({ providers: [GitHub] }) // proxy.ts export { auth as proxy } from "@/auth" //…

Official Documentation ↗
CompatibilityThis documentation covers version v5.0. Check the official docs for the latest API surface.

Installation

npmnpm install next-auth
pnpmpnpm add next-auth
yarnyarn add next-auth

Methods

Overview

NextAuth v5 is the Next.js integration of Auth.js. It wires OAuth providers, session strategies and middleware into a Next.js application through the NextAuth() export shown in the official documentation excerpt. The official README provides no verifiable API example beyond that snippet, so method signatures and return values remain unverified.

API reference status

The official README provides no verifiable API example, so this page does not list method signatures (unverified).

Security notes

Quoted verbatim from the official documentation; this is not a complete threat model. 来源:https://authjs.dev/ · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:51:07.572Z.

  • About Auth.js Introduction Security Discord Community Download GitHub NPM Acknowledgements Contributors Auth.js © Better Auth Inc. (https://authjs.dev/)

Verification notes

Errors

The official API reference declares the following error types:

  • AuthError (class(Base error class for all Auth.js errors,Extends Error)) — official text: “Base error class for all Auth.js errors. It’s optimized to be printed in the server logs in a nicely formatted way via the logger.error option.” (source: https://authjs.dev/reference/nextjs#autherror, fetched 2026-11-08T17:41:29+08:00)
  • MissingSecretError (生产环境缺少 AUTH_SECRET 时抛出(详见 core/errors#missingsecret)) — official text: “In production, AUTH_SECRET is a required environment variable - if not set, NextAuth.js will throw an error.” (source: https://authjs.dev/reference/nextjs, fetched 2026-11-08T17:41:29+08:00)

API reference evidence

Fetched from official sources on 2026-11-08T17:41:29+08:00 via PowerShell Invoke-WebRequest 下载 npm 官方包 next-auth@beta 的 index.d.ts(cdn.jsdelivr.net/npm/next-auth@beta);WebFetch https://authjs.dev/reference/nextjs 与 https://authjs.dev/getting-started/installation.

FAQ

What does next-auth do?
export const { auth, handlers } = NextAuth({ providers: [GitHub] }) // proxy.ts export { auth as proxy } from "@/auth" // app/api/auth/[...nextauth]/route.ts export const { GET, POST } = han
How do I install next-auth?
Run `npm install next-auth`.
Where can I verify the API details?
Official repository/documentation: https://authjs.dev/. Checked on 2026-11-04; signatures and return values not stated in the official README are marked unverified.