Next.js Discord

Discord Forum

Getting wrong Typescript intellisense for Next-Auth `profile` object in `signIn()` callback.(?)

Answered
TOM posted this in #help-forum
Open in Discord
TOMOP
Hi. I'm learning NextAuth. While trying to set up a google login, I wasn't able to get the image from the profile object in sign in. On debugging and seeing the profile object upclose it turned out that the profile object didn't have an image variable at all. It had a picture variable. But the typescript keeps insisting that picture doesn't exist. What might be causing this issue?
Answered by TOM
Turns out I had to add extend the type definition myself in types/next-auth.d.ts
View full answer

3 Replies

TOMOP
!solved
TOMOP
Turns out I had to add extend the type definition myself in types/next-auth.d.ts
Answer
TOMOP
This did the trick
interface Profile {
    picture?: string
  }