Socket
Socket
Sign inDemoInstall

@next-auth/mongodb-adapter

Package Overview
Dependencies
0
Maintainers
4
Versions
24
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @next-auth/mongodb-adapter

mongoDB adapter for next-auth.


Version published
Maintainers
4
Created

Readme

Source


    

mongoDB Adapter - NextAuth.js

Open Source. Full Stack. Own Your Data.

CI Test Bundle Size @next-auth/mongodb-adapter Version

Overview

This is the mongoDB 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 mongoDB schema in the docs at next-auth.js.org/adapters/mongodb.

Getting Started

  1. Install next-auth and @next-auth/mongodb-adapter
npm install next-auth @next-auth/mongodb-adapter
  1. Add this adapter to your pages/api/[...nextauth].js next-auth configuration object.
import NextAuth from "next-auth"
import Providers from "next-auth/providers"
import { MongoDBAdapter } from "@next-auth/mongodb-adapter"
import { MongoClient, ObjectId } from "mongodb"

const client = new MongoClient(process.env.MONGODB_URL)

// 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: MongoDBAdapter({
    db: () => client.db("your-database"),
    ObjectId
  })
  ...
})

Contributing

We're open to all community contributions! If you'd like to contribute in any way, please read our Contributing Guide.

License

ISC

Keywords

FAQs

Last updated on 28 Aug 2021

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc