import { Password } from '@convex-dev/auth/providers/Password';
import { convexAuth } from '@convex-dev/auth/server';
import { ResendOTPPasswordReset } from '../resend/PasswordReset/ResendOTPPasswordReset';
import { ResendOTP } from '../resend/ResendOTP';
export const { auth, signIn, signOut, store } = convexAuth({
providers: [
Password({
id: 'password-code',
reset: ResendOTPPasswordReset,
verify: ResendOTP,
}),
],
callbacks: {
async afterUserCreatedOrUpdated(ctx, { userId }) {
if (!userId) return;
await ctx.db.patch(userId, {
role: 'user',
});
},
},
session: {
totalDurationMs: 1000 * 60 * 60 * 24 * 30, // 90 days
inactiveDurationMs: 1000 * 60 * 60 * 24 * 7, // 7 days
},
});
import { Password } from '@convex-dev/auth/providers/Password';
import { convexAuth } from '@convex-dev/auth/server';
import { ResendOTPPasswordReset } from '../resend/PasswordReset/ResendOTPPasswordReset';
import { ResendOTP } from '../resend/ResendOTP';
export const { auth, signIn, signOut, store } = convexAuth({
providers: [
Password({
id: 'password-code',
reset: ResendOTPPasswordReset,
verify: ResendOTP,
}),
],
callbacks: {
async afterUserCreatedOrUpdated(ctx, { userId }) {
if (!userId) return;
await ctx.db.patch(userId, {
role: 'user',
});
},
},
session: {
totalDurationMs: 1000 * 60 * 60 * 24 * 30, // 90 days
inactiveDurationMs: 1000 * 60 * 60 * 24 * 7, // 7 days
},
});