How do you insert an auth.users in a seed file? #1323
-
I have been using Currently in my seed file I am able to connect my
After doing this I would love to create a user. Simply inserting a user I don't think works because the password is not encrypted or I might be missing potential needed fields to login. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Is this for new users to your system or are you migrating from another database to Supabase? if new users you are probably best off doing a loop with all the users and calling the If they are existing users then turn off email confirmation and do a loop with all the users again while calling Otherwise, if you want to do a straight DB insertion you will need to find out what encryption function is being used for the passwords and how you can call it inside of your SQL migration. |
Beta Was this translation helpful? Give feedback.
-
@silentworks yeah this is a fresh DB, essentially anytime I reset and clear my database I want to re-insert the same user. I was attempting to do it via SQL insert but as you mention I am not exactly sure how to encrypt the password |
Beta Was this translation helpful? Give feedback.
Is this for new users to your system or are you migrating from another database to Supabase?
if new users you are probably best off doing a loop with all the users and calling the
await supabase.auth.api.inviteUserByEmail('email_address_here')
with their email address and provide a page for them to complete the process.If they are existing users then turn off email confirmation and do a loop with all the users again while calling
await supabase.auth.signUp({ email, password })
and let Supabase deal with the encryption for you.Otherwise, if you want to do a straight DB insertion you will need to find out what encryption function is being used for the passwords and how you can call it ins…