I've been diving into a helpful tutorial on implementing roles in the next-auth session. However, I've encountered an issue where adding the profile
property results in unexpected behavior with the profile being undefined. Additionally, there are typescript errors cropping up. I'm not sure if this is a mistake on my end or a known bug, as my search didn't yield any relevant results.
Here's an excerpt of my code:
export const authOptions: AuthOptions = {
secret: process.env.NEXT_PUBLIC_SECRET!,
providers: [
GoogleProvider({
clientId: process.env.GOOGLE_CLIENT_ID!,
clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
// profile: async (profile) => {
// return { ...profile, role: profile.role ?? Role.USER };
// },
}),
],
pages: {
signIn: "/",
},
adapter: PrismaAdapter(prisma),
};
It mirrors the code from the tutorial, and upon commenting out the profile section, the behavior aligns with my expectations, albeit without the role feature. Any insights or assistance would be greatly appreciated!
Next.js Version: 13.4.1 (app directory)