mirror of
https://github.com/SrIzan10/next-auth.git
synced 2026-05-01 10:55:20 +00:00
Next.js 13.4 [is out](https://nextjs.org/blog/next-13-4). For discussing project-related issues, please use https://github.com/nextauthjs/next-auth/discussions/8487 The new version of NextAuth.js is based on `@auth/core`. If you want to test it out, you can do so already, installing `next-auth@experimental`: - **Documentation**: https://authjs.dev/reference/nextjs - **Migration guide**: https://authjs.dev/guides/upgrade-to-v5 BREAKING CHANGE: Follow the [migration guide](https://authjs.dev/guides/upgrade-to-v5)
53 lines
1.3 KiB
TypeScript
53 lines
1.3 KiB
TypeScript
import type { NextAuthConfig } from "next-auth"
|
|
import Auth0 from "next-auth/providers/auth0"
|
|
import Credentials from "next-auth/providers/credentials"
|
|
import Facebook from "next-auth/providers/facebook"
|
|
import GitHub from "next-auth/providers/github"
|
|
import Google from "next-auth/providers/google"
|
|
import Twitter from "next-auth/providers/twitter"
|
|
|
|
declare module "next-auth" {
|
|
/**
|
|
* Returned by `useSession`, `getSession` and received as a prop on the `SessionProvider` React Context
|
|
*/
|
|
interface Session {
|
|
user: {
|
|
/** The user's postal address. */
|
|
address: string
|
|
} & User
|
|
}
|
|
|
|
interface User {
|
|
foo: string
|
|
}
|
|
}
|
|
|
|
export default {
|
|
debug: false,
|
|
providers: [
|
|
GitHub({ account() {} }),
|
|
Auth0,
|
|
Facebook,
|
|
Google,
|
|
Twitter,
|
|
Credentials({
|
|
credentials: { password: { label: "Password", type: "password" } },
|
|
authorize(c) {
|
|
if (c.password !== "password") return null
|
|
return {
|
|
id: "test",
|
|
foo: "bar",
|
|
name: "Test User",
|
|
email: "test@example.com",
|
|
}
|
|
},
|
|
}),
|
|
],
|
|
callbacks: {
|
|
jwt({ token, trigger, session }) {
|
|
if (trigger === "update") token.name = session.user.name
|
|
return token
|
|
},
|
|
},
|
|
} satisfies NextAuthConfig
|