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 f6767a32..d4109d52 100644 --- a/android/src/main/java/io/invertase/firebase/auth/RNFirebaseAuth.java +++ b/android/src/main/java/io/invertase/firebase/auth/RNFirebaseAuth.java @@ -387,6 +387,39 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule { } } + /** + * sendSignInLinkToEmail + * + * @param email + * @param promise + */ + @ReactMethod + public void sendSignInLinkToEmail(String appName, String email, ReadableMap actionCodeSettings, final Promise promise) { + Log.d(TAG, "sendSignInLinkToEmail"); + FirebaseApp firebaseApp = FirebaseApp.getInstance(appName); + FirebaseAuth firebaseAuth = FirebaseAuth.getInstance(firebaseApp); + + OnCompleteListener listener = new OnCompleteListener() { + @Override + public void onComplete(@NonNull Task task) { + if (task.isSuccessful()) { + Log.d(TAG, "sendSignInLinkToEmail:onComplete:success"); + promiseNoUser(promise, false); + } else { + Exception exception = task.getException(); + Log.e(TAG, "sendSignInLinkToEmail:onComplete:failure", exception); + promiseRejectAuthException(promise, exception); + } + } + }; + + + ActionCodeSettings settings = buildActionCodeSettings(actionCodeSettings); + firebaseAuth.sendSignInLinkToEmail(email, settings).addOnCompleteListener(listener); + } + + + /* ---------------------- * .currentUser methods * ---------------------- */