KıteK
Convex Community2y ago
40 replies
Kıte

Convex Auth Google OAuth

Hello I've tried looking in the docs and can't find any relative to this problem. I'm trying to separate name and last name from Google Auth but when I do this code it doesn't let me login nor create new user.

any idea for this?

export const { auth, signIn, signOut, store } = convexAuth({
  providers: [
    Google({
      profile: (prof) => {
        return {
          ...prof,
          id: prof.id,
          email: prof.email,
          name: prof.give_name,
          lastname: prof.last_name,
          image: prof.picture
        };
      },
    }),
  ],
});

this is my custom schema for user
users: defineTable({
    email: v.optional(v.string()),
    emailVerificationTime: v.optional(v.float64()),
    image: v.optional(v.string()),
    isAnonymous: v.optional(v.boolean()),
    name: v.optional(v.string()),
    lastname: v.optional(v.string()),
    phone: v.optional(v.string()),
    phoneVerificationTime: v.optional(v.float64()),
  })
    .index("email", ["email"])
    .index("phone", ["phone"])
    .searchIndex("search_by_email", {
      searchField: "email",
    })
    .searchIndex("search_by_name", { searchField: "name" }),
Was this page helpful?