Update Avatar on OAuth Login

Hi there, so I have Discord OAuth as a login option for my website, however I'd like it so when you login with Discord, it updates the user's avatar to be the latest avatar from Discord - rather than only using the avatar when the user first signs up with Discord.

I was looking through the docs and seen that I could do a before and after database hook for the social account, however when printing the account, as well as the provided context, I cant see anywhere the response from Discord when logging in via OAuth, aka the object that contains the user's email, avatar, etc.

Would appreciate if anybody could guide me in the right direction, thanks in advance!

databaseHooks: {
    // When signing up or signing in with OAuth, ensure the user's access
    // and refresh tokens are encrypted when stored in the database.
    account: {
        create: {
            before: async (account) => {
                return encryptAccountData(account);
            },
        },
        update: {
            before: async (account, context) => {
                console.log("update social acc", account, context);
                return encryptAccountData(account);
            },
        },
    },
},
Solution
update on the above in-case anybody wants to know what i done to "resolve" it - https://cdn.rainnny.club/hnUdnBVr.png little jank but this works i suppose
Was this page helpful?