跳至內容
從 NextAuth.js v4 遷移?請閱讀 我們的遷移指南.

自訂頁面

若要啟用自訂頁面,請將以下內容新增至您的 Auth.js 設定。在 pages 物件中,鍵是頁面類型,值是頁面所在的路径/路由。請確保您在指定的路由上確實有一個頁面。

./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)

若要繼續設定自訂頁面,請查看我們的自訂頁面指南

Auth.js © Balázs Orbán 和團隊 -2024