Skip to content
Migrating from NextAuth.js v4? Read our migration guide.
Auth.js
Authentication for the Web.
Free and open source.
Looking for a hosted alternative?

Use Clerk

Sponsored
// auth.ts
import NextAuth from "next-auth"
import GitHub from "next-auth/providers/github"
export const { auth, handlers } = NextAuth({ providers: [GitHub] })
 
// middleware.ts
export { auth as middleware } from "@/auth"
 
// app/api/auth/[...nextauth]/route.ts
import { handlers } from "@/auth"
export const { GET, POST } = handlers
// src/auth.ts
import { SvelteKitAuth } from "@auth/sveltekit"
import GitHub from '@auth/sveltekit/providers/github'
 
export const { handle } = SvelteKitAuth({
  providers: [GitHub],
})
 
// src/hooks.server.ts
export { handle } from "./auth"
// server.ts
import { express } from "express"
import { ExpressAuth } from "@auth/express"
import GitHub from "@auth/express/providers/github"
 
const app = express()
 
app.use("/auth/*", ExpressAuth({ providers: [GitHub] }))
// auth.ts
import NextAuth from "next-auth"
import GitHub from "next-auth/providers/github"
export const { auth, handlers } = NextAuth({ providers: [GitHub] })
 
// middleware.ts
export { auth as middleware } from "@/auth"
 
// app/api/auth/[...nextauth]/route.ts
import { handlers } from "@/auth"
export const { GET, POST } = handlers
// src/auth.ts
import { SvelteKitAuth } from "@auth/sveltekit"
import GitHub from '@auth/sveltekit/providers/github'
 
export const { handle } = SvelteKitAuth({
  providers: [GitHub],
})
 
// src/hooks.server.ts
export { handle } from "./auth"
// server.ts
import { express } from "express"
import { ExpressAuth } from "@auth/express"
import GitHub from "@auth/express/providers/github"
 
const app = express()
 
app.use("/auth/*", ExpressAuth({ providers: [GitHub] }))
// auth.ts
import NextAuth from "next-auth"
import GitHub from "next-auth/providers/github"
export const { auth, handlers } = NextAuth({ providers: [GitHub] })
 
// middleware.ts
export { auth as middleware } from "@/auth"
 
// app/api/auth/[...nextauth]/route.ts
import { handlers } from "@/auth"
export const { GET, POST } = handlers
// src/auth.ts
import { SvelteKitAuth } from "@auth/sveltekit"
import GitHub from '@auth/sveltekit/providers/github'
 
export const { handle } = SvelteKitAuth({
  providers: [GitHub],
})
 
// src/hooks.server.ts
export { handle } from "./auth"
// server.ts
import { express } from "express"
import { ExpressAuth } from "@auth/express"
import GitHub from "@auth/express/providers/github"
 
const app = express()
 
app.use("/auth/*", ExpressAuth({ providers: [GitHub] }))

Supports all these providers and more!

Facebook logo
Notion logo
Cognito logo
OneLogin logo
Pipedrive logo
EVE Online logo
GitHub logo
Authentik logo
Box logo
WordPress.com logo
Yandex logo
Google logo
Azure Active Directory B2C logo
Mailchimp logo
Netlify logo
Auth.js © Balázs Orbán and Team - 2025