Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
@next-auth/prisma-adapter
Advanced tools
Open Source. Full Stack. Own Your Data.
This is the Prisma Adapter for next-auth
. This package can only be used in conjunction with the primary next-auth
package. It is not a standalone package.
You can find the Prisma schema in the docs at next-auth.js.org/adapters/prisma.
next-auth
and @next-auth/prisma-adapter
npm install next-auth @next-auth/prisma-adapter
pages/api/[...nextauth].js
next-auth configuration object.import NextAuth from "next-auth"
import Providers from "next-auth/providers"
import { PrismaAdapter } from "@next-auth/prisma-adapter"
import * as Prisma from "@prisma/client"
const prisma = new Prisma.PrismaClient()
// For more information on each option (and a full list of options) go to
// https://next-auth.js.org/configuration/options
export default NextAuth({
// https://next-auth.js.org/configuration/providers
providers: [
Providers.Google({
clientId: process.env.GOOGLE_ID,
clientSecret: process.env.GOOGLE_SECRET,
}),
],
adapter: PrismaAdapter(prisma)
...
})
In order to add custom fields to the database, you must first add them to your Prisma schema file, for example.
model User {
id String @id @default(cuid())
name String?
email String? @unique
emailVerified DateTime?
image String?
> google String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
accounts Account[]
sessions Session[]
}
When running prisma migrate
, Prisma will create the User table with the above schema in your specified underlying database.
Then, during the first sign-in NextAuth.js will return the simpler prototype user object, but after the first sign-in, NextAuth.js will return the full custom User object, including your custom field and userId, in callbacks such as sign-in.
We're open to all community contributions! If you'd like to contribute in any way, please first read our Contributing Guide.
ISC
FAQs
Prisma adapter for next-auth.
The npm package @next-auth/prisma-adapter receives a total of 74,044 weekly downloads. As such, @next-auth/prisma-adapter popularity was classified as popular.
We found that @next-auth/prisma-adapter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.