HmzaH
Convex Community2y ago
1 reply
Hmza

lucia auth with user roles

just starting out with convex and while still learning about schemas and mutations with convex here.

how can i add another field in the numbers tables from the example on github, field would be simply users_id to attach user to numbers (which they created)

end goal: to create new table with user roles.

ref: https://stack.convex.dev/convex-with-lucia

import { defineSchema, defineTable } from "convex/server";
import { authTables } from "@convex-dev/convex-lucia-auth";
import { v } from "convex/values";

export default defineSchema(
{
...authTables({
user: {
email: v.string(),
},
session: {},
}),
numbers: defineTable({
user: v.id(authTables.users._id)
value: v.number(),
}),
},
{ schemaValidation: true },
);
Learn how to build a full stack app with authentication without any third-party auth providers, using Convex and the Lucia library.
Custom Authentication (with Lucia)
Was this page helpful?