Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(authentication): add fetchSignInMethodsForEmail(...) method #592

Closed
3 of 12 tasks
DontGiveAFck opened this issue Mar 21, 2024 · 6 comments · Fixed by #593
Closed
3 of 12 tasks

feat(authentication): add fetchSignInMethodsForEmail(...) method #592

DontGiveAFck opened this issue Mar 21, 2024 · 6 comments · Fixed by #593

Comments

@DontGiveAFck
Copy link

DontGiveAFck commented Mar 21, 2024

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

@robingenz
Copy link
Member

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?

@DontGiveAFck
Copy link
Author

@robingenz

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.

Firebase docs

@DontGiveAFck
Copy link
Author

@robingenz

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.

@robingenz
Copy link
Member

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

@DontGiveAFck
Copy link
Author

@robingenz
I checked this build:

  1. There is still no user email returned from login error. I mentioned possible fix in this comment
  2. fetchSignInMethodsForEmail works fine on ios, but on android there is an issue (screenshot attached)
Screenshot 2024-03-22 at 13 54 36

@robingenz
Copy link
Member

robingenz commented Mar 22, 2024

  1. Yes, this PR only covers the fetchSignInMethodsForEmail method for now. Please create a separate issue for the FirebaseAuthUserCollisionException.
  2. Thanks, I will fix it for Android.

@robingenz robingenz changed the title feat: Add available providers property on account-exists-with-different-credential error code feat(authentication): add fetchSignInMethodsForEmail(...) method Mar 22, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants