Created
          December 28, 2021 14:06 
        
      - 
      
- 
        Save skolhustick/e54ab65d48a2aaee4ca3fb658ded9c0a 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({ | |
| 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