cps-user3C
Convex Community3y ago
2 replies
cps-user3

How to update identity.name

Hello, I am creating a user table with the code below.

export const create = mutation({
args: {},
handler: async (ctx, args) => {
const identity = await ctx.auth.getUserIdentity();

if (!identity) {
throw new Error("Not authenticated");
}

const userId = identity.subject;
const userName = identity.name;

const user = await ctx.db.insert("users", {
userId,
userName,
});

return user;
}
});

Is there a way to get a name from the client and update the identity.name with that value?
Was this page helpful?