'add Email/Password provider even there's another provider using the email
My application have sign in methods like:
- 3rd party provider (Facebook, Google, Apple)
- Email/Password
There's a feature from the app where the user can switch to traditional login but they need to provide a Password for the account in order to continue.
This error always show whenever I'm calling the createUserWithEmailAndPassword from the FirebaseAuth to create an Email/Password auth provider for the user that already exists but using different provider like Facebook etc.
[firebase_auth/email-already-in-use] The email address is already in use by another account.
How can I fix this error? Should I change something in my authentication flow?
Solution 1:[1]
What you are doing when you call createUserWithEmailAndPassword is trying to create an account that already exists. In FireBase it is possible to have a user who does not have a password and that is the situation you have.
Instead, I believe you need to use User.updatePassword() (https://pub.dev/documentation/firebase_auth/latest/firebase_auth/User/updatePassword.html)
Then you can use FirebaseAuth.instance.signInWithEmailAndPassword() to sign in.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Sylith |
