Updating profile pictures from next-auth providers

So I am trying to get next-auth to update the user's profile picture when they sign in. Googling lead me to this: https://github.com/nextauthjs/next-auth/discussions/1414 Which seems very reasonable, so I am adding some logic to the sign in callback In [...nextauth]. The problem I am facing is that I am not can't seem to get the image URL/id to check against the one saved in my DB. The attached Image shows that the profile object contains what i want, the avatar or the image_url is all I need. Intellisense gives me an profile.image suggestion, which returns undefined, and cant seems to do anything like profile.avatar or profile.image_url to get the value. Am I just missing some TS trick to get the avatar value from the profile object?
GitHub
How to update user's profile image beyond first login · nextauthjs/...
Your question I'm successfully storing a user's profile image (using the standard Discord provider), but it seems after the user changes their profile image it never updates in the ...
1 Reply
Mordi
MordiOP2y ago
TLDR: console.log of profile shows the info I want, image_url. intellisense and types does not want to give me the image_url. Ended up settling with this
//@ts-ignore
const imageUrl = profile.image_url;
//@ts-ignore
const imageUrl = profile.image_url;
Want results from more Discord servers?
Add your server