stacker.news/pages/api/auth/[...nextauth].js

44 lines
1022 B
JavaScript
Raw Normal View History

2021-03-25 19:29:24 +00:00
import NextAuth from 'next-auth'
import Providers from 'next-auth/providers'
import Adapters from 'next-auth/adapters'
import prisma from '../../../api/models'
export default (req, res) => NextAuth(req, res, options)
const options = {
providers: [
Providers.GitHub({
clientId: process.env.GITHUB_ID,
2021-05-21 19:34:40 +00:00
clientSecret: process.env.GITHUB_SECRET,
profile: profile => {
return {
...profile,
name: profile.login
}
}
2021-04-24 21:05:07 +00:00
}),
Providers.Twitter({
clientId: process.env.TWITTER_ID,
2021-05-21 19:34:40 +00:00
clientSecret: process.env.TWITTER_SECRET,
profile: profile => {
return {
...profile,
name: profile.screen_name
}
}
2021-03-25 19:29:24 +00:00
}),
Providers.Email({
2021-06-02 14:23:30 +00:00
server: process.env.LOGIN_EMAIL_SERVER,
from: process.env.LOGIN_EMAIL_FROM,
2021-05-21 19:34:40 +00:00
profile: profile => {
return profile
}
2021-03-25 19:29:24 +00:00
})
],
adapter: Adapters.Prisma.Adapter({ prisma }),
secret: process.env.SECRET,
2021-04-24 21:05:07 +00:00
pages: {
signIn: '/login'
}
}