Hey, I am using Supabase for a project I am buildi...
# help
j
Hey, I am using Supabase for a project I am building in NextJS, along with
@supabase/supabase-auth-helpers
I have a
profiles
table in the
public
schema that is automatically created (via a trigger/function) when a user signs up (via email or a provider), I have a column on this table called
role
which can be
user
or
admin
for now, depending on the signup flow. I am struggling to set this role field when using the
Auth
component in the helpers / when using third party providers. With the email/password signup JS library it's possible to do:
supabase.auth.signUp({...}, {data: {role: 'admin'}})
which I can then access in my trigger/function to set the role on the
profiles
table. However, I am struggling to do similar (doesn't seem to exist) when signing in (or up) with a provider / when using the
Auth
component. Forgive me if I am missing something obvious here, but I would be grateful to see how others are doing similar. Thanks in advance.
s
You are correct about the Auth component not accepting additional data. You can just not use the Auth component and create your own Sign Up form along with the call to
supabase.auth.signUp
yourself with the correct additional data, but you should use the supabase instance from the supabase-auth-helpers.
j
Thanks, is there a way to disable automatic creation of users via provider?
I.e I want to create a login page to an admin application, with GitHub login. I want to implement an invitation flow (users can invite other users). To do this, I need to disable the "create user" part on the generic login page, otherwise anyone can sign in?