https://supabase.com/ logo
#help
Title
# help
d

DanMossa

03/30/2022, 10:07 PM
Hey! I'm unsure what the proper flow is for when a user tries to signIn/signUp with the same email that they used to create an account with a provider. So, if they sign in with google, I see a row added to my auth.users schema and I can see that in
raw_app_meta_data
it shows their provider. But now if they login with their email being the same as the google email, I get an error that their email is already in use, and if it's a create account, then it's an incorrect username and password. How can I get the app_meta_data? or what's the proper flow?
n

Needle

03/30/2022, 10:07 PM
Hello ! This thread has been automatically created from your message in a ``few seconds ago``. Pinging @User so that they see this as well! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ... menu) and select Leave Thread to unsubscribe from future updates. Want to change the title? Use the
/title
command! We have solved your problem? Click the button below to archive it.
🆕 view app_meta_data
g

garyaustin

03/30/2022, 10:17 PM
I was looking into this a few weeks back... https://github.com/supabase/supabase/discussions/5827 I flagged a Supabase dev, but no response. "I created email signup with password and then was able to also log in with discord and both worked. You could see both email and discord as providers in the auth table. I then deleted the user and logged in with discord first. Next I tried to signup with email/password. That did NOT work. No confirm email is sent and email provider is not added to the auth table. Turning off email confirmation gets "user already registered" message. EDIT: If you force a password change on the user after Discord signup, the email/password login will start working, but email is not listed as a provider."
n

Needle

03/30/2022, 10:17 PM
view app_meta_data
d

DanMossa

03/30/2022, 10:29 PM
Rough. So I might have to make a function to get the provider from raw_app and go from there
Also, if I create a user with email and password it all works, but then when I sign in with google and use to sign in, I get
error saving new user
Any ideas?
g

garyaustin

03/30/2022, 10:33 PM
I thought that case worked for me, but I just tried with Discord... not sure what difference would be. Also there have been changes to gotrue the past week.
d

DanMossa

03/30/2022, 10:34 PM
Rough. Okay so working scenarios: * signUp with email password * signIn with OpenID google provider. Not working: * signIn with google and THEN sign in with email * signIn with email, and THEN sign in with google
g

garyaustin

03/30/2022, 10:34 PM
In the email first case, it added a discord provider to the meta in addition to email provider, but not opposite way.
d

DanMossa

03/30/2022, 10:35 PM
You could signup with email and then successfully sign in with discord?
g

garyaustin

03/30/2022, 10:35 PM
Yes
d

DanMossa

03/30/2022, 10:35 PM
The heckie
Are you passing in an openID? Or how are you doing it?
g

garyaustin

03/30/2022, 10:35 PM
Well as a new signin
this was the sum of my testing code, where I would use signUp for email and signIn for Discord deleting user between tests....
Copy code
/*
    const {user, error} = await supabase.auth.signUp({
        //provider: 'discord',
        email:'ga@gr.com',
        password:'test1324'
    },{
  redirectTo: 'http://s.us/so'
})
*/
It was a few weeks ago and was just curious how it worked. I only use email/pass (now with the new OTP) method for my real code. I really dislike users not having access when Discord, etc. are down... which seems to happen a bit.
I think I used this to get email working after Discord being first:
Copy code
/* const { data, error:error1 } = supabase.auth.api
  .resetPasswordForEmail('ga@gr.com')
    console.log('reset',data,error1)
    */
And then updated the user password.
d

DanMossa

03/30/2022, 10:47 PM
So you basically just pass in a provider and change it from sign up to signin?
g

garyaustin

03/30/2022, 10:48 PM
Yeah I was just doing a test.
d

DanMossa

03/30/2022, 10:49 PM
Holy heell
The error is,
duplicate key value violates unique constraint "users_email_key"
So it's not updating
Wow this sucks lol