Next.js Discord

Discord Forum

Removing default properties from JWT/User types.

Unanswered
Giant panda posted this in #help-forum
Open in Discord
Giant pandaOP
next-auth.d.ts
import { DefaultSession } from "next-auth";

declare module "next-auth" {
  interface Session extends DefaultSession {
    user?: User;
  }

  interface User {
    id: string;
  }
}

declare module "next-auth/jwt" {
  interface JWT {
    id: string;
  }
}


I'm attempting to remove default properties such as name, email, picture, and sub and only have an id property.

Because the profile callback of a provider user object is empty if I do not provide an email, name, and image.

I tried omit to remove the properties, but they were still present.

1 Reply

Giant pandaOP