feat(authentication): add `fetchSignInMethodsForEmail(...)` method
DontGiveAFck opened this issue · comments
Plugin(s)
- Analytics
- App
- App Check
- Authentication
- Crashlytics
- Cloud Firestore
- Cloud Messaging
- Cloud Storage
- Performance
- Remote Config
Current problem
On account-exists-with-different-credential
error code user should be forced to use sign in method that was used previously, but when this error thrown there is no way to detect available sign in methods.
Preferred solution
When account-exists-with-different-credential
happens, error object should also contain availableProviders
property (or email
property and fetchSignInMethodsForEmail
method should be implemented in plugin).
Alternative options
No response
Additional context
No response
Before submitting
- I have read and followed the feature request guidelines.
- I have attached links to possibly related issues and discussions.
The fetchSignInMethodsForEmail
method seems to be deprecated on the native platforms, see Firebase docs.
Can you share a link to the docs regarding the availableProviders
property?
availableProviders
prop doesn't exists, I just wrote it as an example of another prop that might exist. (Looks like that it doesn't)
Possible solution - signInWithCredentials
method throws FirebaseAuthUserCollisionException
exception that contains email
field and it can be used with firebase js sdk at least to handle this error somehow. Because now we forced to ask user to type email manually and check available providers that sounds like an issue.
Regarding fetchSignInMethodsForEmail - yes, it's deprecated but it would be nice to have it if we will know user's email from solution above, so firebase js sdk will be not needed and issue will be fixed.
Please give this dev build a try and let me know if everything works as expected:
npm i @capacitor-firebase/authentication@5.4.1-dev.e2f5589.1711099069
@robingenz
I checked this build:
- There is still no user email returned from login error. I mentioned possible fix in this comment
fetchSignInMethodsForEmail
works fine on ios, but on android there is an issue (screenshot attached)
- Yes, this PR only covers the
fetchSignInMethodsForEmail
method for now. Please create a separate issue for theFirebaseAuthUserCollisionException
. - Thanks, I will fix it for Android.