fetchSignInMethodsForEmail() method is not returning the PHONE_SIGN_IN_METHOD method

[REQUIRED] Describe your environment

  • Operating System version: any
  • Browser version: any
  • Firebase SDK version: 7.22.1
  • Firebase Product: auth

[REQUIRED] Describe the problem

The fetchSignInMethodsForEmail() method is not returning the ‘phone’ method (auth.PhoneAuthProvider.PHONE_SIGN_IN_METHOD). I’m only getting ['facebook.com', 'password'], but when I inspect the providerData property of currentUser, ‘phone’ provider is listed:

(Similar to #3856)

Steps to reproduce:

console.log(auth().fetchSignInMethodsForEmail(currentUser.email))

[
  "password",
  "facebook.com"
]

console.log(currentUser.providerData)

[
	{
	  "uid": "xxxxx",
	  "displayName": "xxxxx",
	  "photoURL": "https://graph.facebook.com/xxxxxxxx/picture",
	  "email": "xxxxxxxx@gmail.com",
	  "phoneNumber": null,
	  "providerId": "facebook.com"
	},
	{
	  "uid": "+xxxxxxxxxxxxx",
	  "displayName": null,
	  "photoURL": null,
	  "email": null,
	  "phoneNumber": "+xxxxxxxxxxxx",
	  "providerId": "phone"
	},
	{
	  "uid": "xxxxxxx@gmail.com",
	  "displayName": null,
	  "photoURL": null,
	  "email": "xxxxxxx@gmail.com",
	  "phoneNumber": null,
	  "providerId": "password"
	}
],

Is this intended or there is a way to get all providers for same user of email?

1 possible answer(s) on “fetchSignInMethodsForEmail() method is not returning the PHONE_SIGN_IN_METHOD method

  1. Here is the response from Firebase team:

    I was able to reproduce this behavior with the JS SDK and with Kotlin on Android. In the description of the method is mentioned that the method ‘Gets the list of possible sign in methods for the given email address.’, so, it returns the possible sign in methods, not all the methods because it fetches by email which phone auth doesn’t have like the other sign in methods.

    But, to be sure, I have escalated this issue to the engineering team for them to take a look and decide if this is working as expected or if there’s indeed a bug, I’ll let you know any news that they share with me.