Change ctx.session.user values to include new ones? Bad idea?

Right now when using ctx.session.user I get a few default options that come with t3-app. .id, .name?, .image? and .email?. Is there a way to change this to include new values? I can't find an obvious spot or I am being silly.
Solution:
You can do this in your auth.ts where the next-auth module is extended. Make sure you don't add anything sensitive when extending. ``` import type { Role } from "@prisma/client"; import { DefaultSession } from "next-auth"; ...
Jump to solution
2 Replies
Solution
VikingKiller
VikingKiller2y ago
You can do this in your auth.ts where the next-auth module is extended. Make sure you don't add anything sensitive when extending. ``` import type { Role } from "@prisma/client"; import { DefaultSession } from "next-auth"; declare module "next-auth" { interface Session { user?: { id: string; role: Role } & DefaultSession["user"]; } interface User { id: string; role: Role; // ...other properties } }
Debaucus
DebaucusOP2y ago
@TobyMcCann Thank you! Additionally, I had to add it to my callbacks: []in order for it to function as I wanted, but it is now working.
Want results from more Discord servers?
Add your server