    Credentials({
      credentials: {
        email: {},
        password: { type: "password" },
      },
      authorize: async (credentials) => {
        const email = credentials.email as string;
        const password = credentials.password as string;
        const user = await db.query.users.findFirst({
          where: eq(users.email, email),
        });
        if (!user) {
          throw new Error("User not found.");
        }
        if (!user.password) {
          throw new Error("Password not found.");
        }
        const valid = bcrypt.compareSync(password, user.password);
        if (!valid) {
          throw new Error("Invalid password.");
        }
        return user;
      },
    }),