forked from mickasmt/next-saas-stripe-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauth.config.ts
53 lines (47 loc) · 1.88 KB
/
auth.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import Google from "next-auth/providers/google"
import { env } from "@/env.mjs"
import type { NextAuthConfig } from "next-auth"
// import { siteConfig } from "@/config/site"
// import { getUserByEmail } from "@/lib/user";
// import MagicLinkEmail from "@/emails/magic-link-email"
// import { prisma } from "@/lib/db"
export default {
providers: [
Google({
clientId: env.GOOGLE_CLIENT_ID,
clientSecret: env.GOOGLE_CLIENT_SECRET,
}),
// Email({
// sendVerificationRequest: async ({ identifier, url, provider }) => {
// const user = await getUserByEmail(identifier);
// if (!user || !user.name) return null;
// const userVerified = user?.emailVerified ? true : false;
// const authSubject = userVerified ? `Sign-in link for ${siteConfig.name}` : "Activate your account";
// try {
// const { data, error } = await resend.emails.send({
// from: 'SaaS Starter App <[email protected]>',
// to: process.env.NODE_ENV === "development" ? '[email protected]' : identifier,
// subject: authSubject,
// react: MagicLinkEmail({
// firstName: user?.name as string,
// actionUrl: url,
// mailType: userVerified ? "login" : "register",
// siteName: siteConfig.name
// }),
// // Set this to prevent Gmail from threading emails.
// // More info: https://resend.com/changelog/custom-email-headers
// headers: {
// 'X-Entity-Ref-ID': new Date().getTime() + "",
// },
// });
// if (error || !data) {
// throw new Error(error?.message)
// }
// // console.log(data)
// } catch (error) {
// throw new Error("Failed to send verification email.")
// }
// },
// }),
],
} satisfies NextAuthConfig