David
David8mo ago

Recommendation for Auth

With the launch of Convex Auth (congrats!) will this be the recommended way of implementing auth in Convex apps in general or would you still recommend another provider such as Clerk? I'm hoping it's Convex Auth. 🙂
6 Replies
Michal Srb
Michal Srb8mo ago
Hey David, it depends! See https://labs.convex.dev/auth/faq
FAQs - Convex Auth
Relations, default values, unique fields and more for Convex
David
DavidOP8mo ago
Ah, nice thanks. I'm probably only going to need fairly basic auth so Convex Auth looks like a pretty nice solution.
Matt Luo
Matt Luo8mo ago
I think one stress-relieving thing is that the columns in Convex Auth's users table don't collide with columns you'd define if you were to add Clerk to your app later. https://labs.convex.dev/auth/setup/schema In this defineTable function, there is no tokenProvider or subject field or anything about getting an external credential.
const schema = defineSchema({
...authTables,
users: defineTable({
name: v.optional(v.string()),
image: v.optional(v.string()),
email: v.optional(v.string()),
emailVerificationTime: v.optional(v.number()),
phone: v.optional(v.string()),
phoneVerificationTime: v.optional(v.number()),
isAnonymous: v.optional(v.boolean()),
// other "users" fields...
}).index("email", ["email"]),
// Your other tables...
});
const schema = defineSchema({
...authTables,
users: defineTable({
name: v.optional(v.string()),
image: v.optional(v.string()),
email: v.optional(v.string()),
emailVerificationTime: v.optional(v.number()),
phone: v.optional(v.string()),
phoneVerificationTime: v.optional(v.number()),
isAnonymous: v.optional(v.boolean()),
// other "users" fields...
}).index("email", ["email"]),
// Your other tables...
});
Customizing Schema - Convex Auth
Relations, default values, unique fields and more for Convex
Indy
Indy8mo ago
We'll make this a bit clearer over time, but you should be able to take full control of the users table including what columns it has. Right now the library looks like it owns it because it's convenient. The main point to override all the behavior would be here: https://labs.convex.dev/auth/advanced#controlling-account-linking-behavior
Advanced: Details - Convex Auth
Relations, default values, unique fields and more for Convex
MapleLeaf 🍁
MapleLeaf 🍁8mo ago
i appreciate the hell out of everything being overrideable :meowthumbsup:
Matt Luo
Matt Luo8mo ago
Thanks Indy, the account linking behavior doc page was one of the first places I navigated to. I really wanted to understand how it worked. I think this page is key to not only understanding account linking, but also figuring out how to have multiple auth identity providers at the same time

Did you find this page helpful?