diff --git a/android/src/main/java/io/invertase/firebase/auth/RNFirebaseAuth.java b/android/src/main/java/io/invertase/firebase/auth/RNFirebaseAuth.java index 49e5acb3..cf97534f 100644 --- a/android/src/main/java/io/invertase/firebase/auth/RNFirebaseAuth.java +++ b/android/src/main/java/io/invertase/firebase/auth/RNFirebaseAuth.java @@ -360,8 +360,7 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule { * @param promise */ @ReactMethod - public void sendPasswordResetEmail(String appName, final String email, - ReadableMap actionCodeSettings, final Promise promise) { + public void sendPasswordResetEmail(String appName, final String email, ReadableMap actionCodeSettings, final Promise promise) { Log.d(TAG, "sendPasswordResetEmail"); FirebaseApp firebaseApp = FirebaseApp.getInstance(appName); FirebaseAuth firebaseAuth = FirebaseAuth.getInstance(firebaseApp); @@ -1165,7 +1164,7 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule { } @ReactMethod - public void fetchProvidersForEmail(String appName, String email, final Promise promise) { + public void fetchSignInMethodsForEmail(String appName, String email, final Promise promise) { FirebaseApp firebaseApp = FirebaseApp.getInstance(appName); FirebaseAuth firebaseAuth = FirebaseAuth.getInstance(firebaseApp); diff --git a/bridge/e2e/auth/auth.e2e.js b/bridge/e2e/auth/auth.e2e.js index cb42656d..02e74ed2 100644 --- a/bridge/e2e/auth/auth.e2e.js +++ b/bridge/e2e/auth/auth.e2e.js @@ -924,7 +924,7 @@ describe('auth()', () => { }); }); - describe('fetchProvidersForEmail()', () => { + describe('fetchProvidersForEmail/fetchSignInMethodsForEmail()', () => { it('it should return password provider for an email address', () => new Promise((resolve, reject) => { const successCb = providers => { @@ -958,7 +958,7 @@ describe('auth()', () => { return firebase .auth() - .fetchProvidersForEmail('test@i-do-not-exist.com') + .fetchSignInMethodsForEmail('test@i-do-not-exist.com') .then(successCb) .catch(failureCb); })); @@ -977,7 +977,7 @@ describe('auth()', () => { return firebase .auth() - .fetchProvidersForEmail('foobar') + .fetchSignInMethodsForEmail('foobar') .then(successCb) .catch(failureCb); })); diff --git a/ios/RNFirebase/auth/RNFirebaseAuth.m b/ios/RNFirebase/auth/RNFirebaseAuth.m index 1ef16d18..fa7e5f17 100644 --- a/ios/RNFirebase/auth/RNFirebaseAuth.m +++ b/ios/RNFirebase/auth/RNFirebaseAuth.m @@ -1010,14 +1010,14 @@ RCT_EXPORT_METHOD(reauthenticateAndRetrieveDataWithCredential:(NSString *) appDi } /** - fetchProvidersForEmail + fetchSignInMethodsForEmail @param NSString email @param RCTPromiseResolveBlock resolve @param RCTPromiseRejectBlock reject @return */ -RCT_EXPORT_METHOD(fetchProvidersForEmail: +RCT_EXPORT_METHOD(fetchSignInMethodsForEmail: (NSString *) appDisplayName email: (NSString *) email @@ -1027,7 +1027,7 @@ RCT_EXPORT_METHOD(fetchProvidersForEmail: (RCTPromiseRejectBlock) reject) { FIRApp *firApp = [RNFirebaseUtil getApp:appDisplayName]; - [[FIRAuth authWithApp:firApp] fetchProvidersForEmail:email completion:^(NSArray *_Nullable providers, NSError *_Nullable error) { + [[FIRAuth authWithApp:firApp] fetchSignInMethodsForEmail:email completion:^(NSArray *_Nullable providers, NSError *_Nullable error) { if (error) { [self promiseRejectAuthException:reject error:error]; } else if (!providers) { diff --git a/lib/modules/auth/index.js b/lib/modules/auth/index.js index 31da864d..c1d57768 100644 --- a/lib/modules/auth/index.js +++ b/lib/modules/auth/index.js @@ -379,6 +379,7 @@ export default class Auth extends ModuleBase { /** * Send reset password instructions via email * @param {string} email The email to send password reset instructions + * @param actionCodeSettings */ sendPasswordResetEmail( email: string, @@ -427,9 +428,21 @@ export default class Auth extends ModuleBase { /** * Returns a list of authentication providers that can be used to sign in a given user (identified by its main email address). * @return {Promise} + * @Deprecated */ fetchProvidersForEmail(email: string): Promise { - return getNativeModule(this).fetchProvidersForEmail(email); + console.warn( + 'Deprecated firebase.auth().fetchProvidersForEmail in favor of firebase.auth().fetchSignInMethodsForEmail()' + ); + return getNativeModule(this).fetchSignInMethodsForEmail(email); + } + + /** + * Returns a list of authentication methods that can be used to sign in a given user (identified by its main email address). + * @return {Promise} + */ + fetchSignInMethodsForEmail(email: string): Promise { + return getNativeModule(this).fetchSignInMethodsForEmail(email); } verifyPasswordResetCode(code: string): Promise {