[firebase_auth]: providerId returns password
when it should be emailLink
#17079
Labels
blocked: customer-response
Waiting for customer response, e.g. more information was requested.
platform: android
Issues / PRs which are specifically for Android.
platform: ios
Issues / PRs which are specifically for iOS.
plugin: auth
Stale
Issue with no recent activity
type: bug
Something isn't working
Is there an existing issue for this?
Which plugins are affected?
Auth
Which platforms are affected?
iOS, Android
Description
I’m using the FlutterFire
firebase_auth
plugin to support both traditional email/password sign-in and email link sign-in in my app. When signing in using an email link, I expected the returnedUser
object’s provider data to clearly indicate that the user authenticated via an email link by returning a providerId ofemailLink
.However, I have observed that the providerId in
user.providerData
is always set topassword
, regardless of whether the user signed in with a password or via an email link.I understand that the EmailAuthCredential class exposes a
signInMethod
property—which correctly returns either "password" or "emailLink"— to indicate the method used. This anyway is not useful in my scenario as I don't have theCredentials
, but only theUser
. To give further context, what i'm trying to accomplish with this is to implement a re-auth flow for when users attempt to do operations which are throwing arequires-recent-login
error (ie: update email, delete account, etc). In order to present the proper re-auth method I fetch thecurrentUser
, extract the provider and present the correct way for them to re-authenticate.Nonetheless, the fact that the User’s
providerData
always showspassword
for theproviderId
is confusing. This behavior makes it difficult to distinguish between a user who signed in with a traditional password and one who used an email link.I found out about
fetchSignInMethodsForEmail
but it seems to be deprecated for now and shouldn't be used.Reproducing the issue
Firebase Core version
3.11.0
Flutter Version
3.27.2
Relevant Log Output
Flutter dependencies
Expand
Flutter dependencies
snippetAdditional context and comments
No response
The text was updated successfully, but these errors were encountered: