get email from metadata with magic link

I've done this before with google sign in, but I don't recall the function I used. Currently I am using a magic link with this function to trigger a new profile:

begin
  insert into public.profiles (id, email)
  values (new.id, new.raw_user_meta_data->>'email');
  return new;
end;

that was just a shot in the dark, but is there some way to populate the "email" field in in "profiles" with the email address from "users" when a new profile is created via a trigger on auth? using magic link authentication
Was this page helpful?