I'm trying to set up auth with an email provider through Next-Auth.
Here's my code:
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,
}),
And here's the action used when the user submit its email:
'use server';
import { signIn } from 'next-auth/react';
import { successToast } from '@/components';
import 'server-only';
type EmailSignInData = {
email: string;
};
export async function emailSignIn(formData: FormData) {
const data = Object.fromEntries(formData) as EmailSignInData;
await signIn('email', data);
successToast(`Link sent to ${data.email}`);
}
Here's the error I'm getting : Can't resolve 'fs'