Database function to handle the creation of new users with Oauth-specific data

I am using a Database Function alongside a Database Trigger to generate public.users in my database whenever a new auth.user is created.

This creation occurs on sign in using supabase.auth.signIn({ provider: 'twitch' }).

The problem I'm hoping to solve is that I'd like to extract additional data from the Twitch provider on account creation, specifically their username.

How do I dig into their response further while signing in + creating a user?
Was this page helpful?