Created
December 28, 2021 15:54
-
-
Save skolhustick/447ed8eec2f491575d3be650d8cd0a34 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import NextAuth from 'next-auth' | |
import { MongoDBAdapter } from '@next-auth/mongodb-adapter' | |
import EmailProvider from 'next-auth/providers/email' | |
import MongoClientPromise from '../../../lib/mongodb' | |
const THIRTY_DAYS = 30 * 24 * 60 * 60 | |
const THIRTY_MINUTES = 30 * 60 | |
export default NextAuth({ | |
pages: { | |
signIn: '/login', | |
verifyRequest: '/verify-request' | |
}, | |
secret: process.env.SECRET, | |
session: { | |
strategy: 'jwt', | |
maxAge: THIRTY_DAYS, | |
updateAge: THIRTY_MINUTES | |
}, | |
adapter: MongoDBAdapter(MongoClientPromise), | |
providers: [ | |
EmailProvider({ | |
server: { | |
host: process.env.EMAIL_SERVER_HOST, | |
port: process.env.EMAIL_SERVER_PORT, | |
auth: { | |
user: process.env.EMAIL_SERVER_USER, | |
pass: process.env.EMAIL_SERVER_PASSWORD | |
} | |
}, | |
from: process.env.EMAIL_FROM | |
}) | |
] | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment