Skip to content
Migrating from NextAuth.js v4? Read our migration guide.
Getting Started
Session Management
Custom Pages

Custom Pages

To enable custom pages add the following to your Auth.js configuration. In the pages object, the key is the type of page and the value is the path/route at which the page is located. Please make sure you actually have a page at the specified route.

./auth.ts
import { NextAuth } from "next-auth"
import Github from "next-auth/providers/github"
 
// Define your configuration in a separate variable and pass it to NextAuth()
// This way we can also 'export const config' for use later
export const config = {
  providers: [Github],
  pages: {
    signIn: "/login",
  },
}
 
export const { signIn, signOut, handle } = NextAuth(config)

To continue setting up the custom page, checkout our guide on custom pages.

Auth.js © Balázs Orbán and Team - 2024