Duplicate Email Issue Google Auth

Hi I am building an app for my sass product, I am using google auth for the sign in and sign up both. But there is a mysterious issue, this yet only happen to one email address that when I am sign in it creates new user account event though that email is already existed in the users table.
export const auth = betterAuth({
database: mongodbAdapter(db),
emailAndPassword: {
enabled: true
},
socialProviders: {
google: {
clientId: process.env.GOOGLE_CLIENT_ID as string,
clientSecret: process.env.GOOGLE_CLIENT_SECRET as string
},
},
session: {
// Set session to expire after 30 days
maxAge: 30 * 24 * 60 * 60,
// Update session on each request
updateAge: 24 * 60 * 60
},
// Ensure we're using the correct database name
modelName: "user",
// Enable account linking for social providers
account: {
accountLinking: {
enabled: true,
// Allow linking accounts with different emails if needed
allowDifferentEmails: false,
// Update user info when linking accounts
updateUserInfoOnLink: true
}
}
})
export const auth = betterAuth({
database: mongodbAdapter(db),
emailAndPassword: {
enabled: true
},
socialProviders: {
google: {
clientId: process.env.GOOGLE_CLIENT_ID as string,
clientSecret: process.env.GOOGLE_CLIENT_SECRET as string
},
},
session: {
// Set session to expire after 30 days
maxAge: 30 * 24 * 60 * 60,
// Update session on each request
updateAge: 24 * 60 * 60
},
// Ensure we're using the correct database name
modelName: "user",
// Enable account linking for social providers
account: {
accountLinking: {
enabled: true,
// Allow linking accounts with different emails if needed
allowDifferentEmails: false,
// Update user info when linking accounts
updateUserInfoOnLink: true
}
}
})
I checked integration guide and can't find any issues related that. Can you help on this please.
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?