export const authComponent = createClient<DataModel>(components.betterAuth);
export const createAuth = (
ctx: GenericCtx<DataModel>,
{ optionsOnly } = { optionsOnly: false },
) => {
return betterAuth({
baseURL: siteUrl,
emailAndPassword: {
enabled: true,
async sendResetPassword(data, request) {
// Send an email to the user with a link to reset their password
},
},
socialProviders: {
github: {
clientId: process.env.GITHUB_CLIENT_ID!,
clientSecret: process.env.GITHUB_CLIENT_SECRET!,
},
},
logger: {
disabled: optionsOnly,
},
baseUrl: siteUrl,
trustedOrigins: [siteUrl],
database: authComponent.adapter(ctx),
plugins: [
convex(),
passkey(),
organization(),
],
});
};
export const authComponent = createClient<DataModel>(components.betterAuth);
export const createAuth = (
ctx: GenericCtx<DataModel>,
{ optionsOnly } = { optionsOnly: false },
) => {
return betterAuth({
baseURL: siteUrl,
emailAndPassword: {
enabled: true,
async sendResetPassword(data, request) {
// Send an email to the user with a link to reset their password
},
},
socialProviders: {
github: {
clientId: process.env.GITHUB_CLIENT_ID!,
clientSecret: process.env.GITHUB_CLIENT_SECRET!,
},
},
logger: {
disabled: optionsOnly,
},
baseUrl: siteUrl,
trustedOrigins: [siteUrl],
database: authComponent.adapter(ctx),
plugins: [
convex(),
passkey(),
organization(),
],
});
};