Theo's Typesafe CultTTC
Theo's Typesafe Cult3y ago
14 replies
hyhy

Refreshing NextAuth Discord provider user details

Not sure how to phrase this so will try to describe in detail:

My website uses the nextauth discord provider (and no other sign in). When a user with an account changes their discord name and then signs in, it doesn't update. When a user changes their discord profile picture (that i'm using as their profile picture on my website) the link breaks (see image).

Is there a way to fetch the user's current username/profile picture on signin and update the database?

Thanks
image.png
Solution
You can type it properly like this (refer the added lines)

import type { DiscordProfile } from "next-auth/providers/discord";

declare module "next-auth" {
  interface Profile extends DiscordProfile { }
}
image.png
Was this page helpful?