38 lines
1.2 KiB
JavaScript
38 lines
1.2 KiB
JavaScript
import NextAuth from "next-auth";
|
|
import { TypeORMLegacyAdapter } from "@next-auth/typeorm-legacy-adapter";
|
|
import EmailProvider from "next-auth/providers/email";
|
|
import * as entities from "../../../lib/entities";
|
|
|
|
// 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: [
|
|
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,
|
|
maxAge: 10 * 60, // Magic links are valid for 10 min only
|
|
}),
|
|
],
|
|
adapter: TypeORMLegacyAdapter({
|
|
type: "mysql",
|
|
database:
|
|
"mysql://nextAuthAdmin:!Sky9fish1972@77.68.17.157:3306/nextauthDB?synchronise=true",
|
|
synchronize: false,
|
|
}),
|
|
secret: "SuperSecret",
|
|
session: {
|
|
jwt: true,
|
|
pages: {},
|
|
theme: "dark",
|
|
debug: true,
|
|
},
|
|
});
|