Next.js Discord

Discord Forum

Auth: Getting more oauth provider information (Discord)?

Unanswered
Bombay-duck posted this in #help-forum
Open in Discord
Bombay-duckOP
The docs at: https://authjs.dev/guides/providers/custom-provider#override-default-provider-config demonstrate customizing the providers config to specify the profile returned.

What is the correct was to extract additional DiscordProfile properties?

Additionally, the image url is not something that is in the DiscordProfile type, but is included when you don't add custom configuration, how can I go about keeping the original image url from the default profile body?

default profile example:
  "name": "name",
  "email": "email@email.com",
  "image": "https://cdn.discordapp.com/avatars/123.png"

DiscordProfile console printout:
{
  id: '123',
  username: 'name',
  avatar: '12345',
  discriminator: '0',
  public_flags: 0,
  premium_type: 0,
  flags: 0,
  banner: null,
  accent_color: null,
  global_name: 'name',
  avatar_decoration_data: null,
  banner_color: null,
  mfa_enabled: true,
  locale: 'en-GB',
  email: 'email@email.com',
  verified: true
}

retrieved via:
 providers: [Discord({
        profile (profile : DiscordProfile) {

            console.log(profile)

0 Replies