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 76a88c80..f0dcb371 100644 --- a/android/src/main/java/io/invertase/firebase/auth/RNFirebaseAuth.java +++ b/android/src/main/java/io/invertase/firebase/auth/RNFirebaseAuth.java @@ -917,6 +917,8 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule { return TwitterAuthProvider.getCredential(authToken, authSecret); case "github": return GithubAuthProvider.getCredential(authToken); + case "phone": + return PhoneAuthProvider.getCredential(authToken, authSecret); case "password": return EmailAuthProvider.getCredential(authToken, authSecret); default: diff --git a/index.d.ts b/index.d.ts index 2041bafe..eb3bd157 100644 --- a/index.d.ts +++ b/index.d.ts @@ -454,6 +454,10 @@ declare module "react-native-firebase" { * Reauthenticate the current user with credentials: */ reauthenticate(credential: Credential): Promise + /** + * Link the user with a 3rd party credential provider. + */ + linkWithCredential(credential: Credential): Promise /** * Refreshes the current user. */ diff --git a/ios/RNFirebase/auth/RNFirebaseAuth.m b/ios/RNFirebase/auth/RNFirebaseAuth.m index 59371314..18faac5c 100644 --- a/ios/RNFirebase/auth/RNFirebaseAuth.m +++ b/ios/RNFirebase/auth/RNFirebaseAuth.m @@ -825,6 +825,8 @@ RCT_EXPORT_METHOD(fetchProvidersForEmail: credential = [FIREmailAuthProvider credentialWithEmail:authToken password:authTokenSecret]; } else if ([provider compare:@"github" options:NSCaseInsensitiveSearch] == NSOrderedSame) { credential = [FIRGitHubAuthProvider credentialWithToken:authToken]; + } else if ([provider compare:@"phone" options:NSCaseInsensitiveSearch] == NSOrderedSame) { + credential = [[FIRPhoneAuthProvider provider] credentialWithVerificationID:authToken verificationCode:authTokenSecret]; } else { NSLog(@"Provider not yet handled: %@", provider); }