@react-native-firebase/auth 18.7.3 → 18.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/android/src/main/java/io/invertase/firebase/auth/ReactNativeFirebaseAuthModule.java +27 -4
- package/ios/RNFBAuth/RNFBAuthModule.m +84 -43
- package/lib/index.d.ts +2 -2
- package/lib/index.js +11 -0
- package/lib/modular/index.js +5 -0
- package/lib/version.js +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,22 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [18.9.0](https://github.com/invertase/react-native-firebase/compare/v18.8.0...v18.9.0) (2024-02-21)
|
7
|
+
|
8
|
+
### Bug Fixes
|
9
|
+
|
10
|
+
- **auth:** use correct app instance (vs always default) in multifactor and phone auth ([#7564](https://github.com/invertase/react-native-firebase/issues/7564)) ([ff32fd3](https://github.com/invertase/react-native-firebase/commit/ff32fd37b39557e9a55fce016cbf986348436b92))
|
11
|
+
|
12
|
+
## [18.8.0](https://github.com/invertase/react-native-firebase/compare/v18.7.3...v18.8.0) (2024-01-25)
|
13
|
+
|
14
|
+
### Features
|
15
|
+
|
16
|
+
- **auth, authDomain:** implement FirebaseOptions.authDomain on Auth ([a1f4710](https://github.com/invertase/react-native-firebase/commit/a1f471029352b7597d7e83a8c1ea06145768cf89))
|
17
|
+
|
18
|
+
### Bug Fixes
|
19
|
+
|
20
|
+
- **auth, ios:** factorId nil check ([#7541](https://github.com/invertase/react-native-firebase/issues/7541)) ([b1cee9a](https://github.com/invertase/react-native-firebase/commit/b1cee9a899e963d5fc5d0f0af056214dd676cd5a))
|
21
|
+
|
6
22
|
## [18.7.3](https://github.com/invertase/react-native-firebase/compare/v18.7.2...v18.7.3) (2023-12-13)
|
7
23
|
|
8
24
|
**Note:** Version bump only for package @react-native-firebase/auth
|
@@ -68,6 +68,7 @@ import com.google.firebase.auth.PhoneMultiFactorInfo;
|
|
68
68
|
import com.google.firebase.auth.TwitterAuthProvider;
|
69
69
|
import com.google.firebase.auth.UserInfo;
|
70
70
|
import com.google.firebase.auth.UserProfileChangeRequest;
|
71
|
+
import io.invertase.firebase.app.ReactNativeFirebaseAppModule;
|
71
72
|
import io.invertase.firebase.common.ReactNativeFirebaseEvent;
|
72
73
|
import io.invertase.firebase.common.ReactNativeFirebaseEventEmitter;
|
73
74
|
import io.invertase.firebase.common.ReactNativeFirebaseModule;
|
@@ -150,6 +151,26 @@ class ReactNativeFirebaseAuthModule extends ReactNativeFirebaseModule {
|
|
150
151
|
mMultiFactorSessions.clear();
|
151
152
|
}
|
152
153
|
|
154
|
+
@ReactMethod
|
155
|
+
public void configureAuthDomain(final String appName) {
|
156
|
+
Log.d(TAG, "configureAuthDomain");
|
157
|
+
FirebaseApp firebaseApp = FirebaseApp.getInstance(appName);
|
158
|
+
FirebaseAuth firebaseAuth = FirebaseAuth.getInstance(firebaseApp);
|
159
|
+
String authDomain = ReactNativeFirebaseAppModule.authDomains.get(appName);
|
160
|
+
Log.d(TAG, "configureAuthDomain - app " + appName + " domain? " + authDomain);
|
161
|
+
if (authDomain != null) {
|
162
|
+
firebaseAuth.setCustomAuthDomain(authDomain);
|
163
|
+
}
|
164
|
+
}
|
165
|
+
|
166
|
+
@ReactMethod
|
167
|
+
public void getCustomAuthDomain(final String appName, final Promise promise) {
|
168
|
+
Log.d(TAG, "configureAuthDomain");
|
169
|
+
FirebaseApp firebaseApp = FirebaseApp.getInstance(appName);
|
170
|
+
FirebaseAuth firebaseAuth = FirebaseAuth.getInstance(firebaseApp);
|
171
|
+
promise.resolve(firebaseAuth.getCustomAuthDomain());
|
172
|
+
}
|
173
|
+
|
153
174
|
/** Add a new auth state listener - if one doesn't exist already */
|
154
175
|
@ReactMethod
|
155
176
|
public void addAuthStateListener(final String appName) {
|
@@ -1119,10 +1140,11 @@ class ReactNativeFirebaseAuthModule extends ReactNativeFirebaseModule {
|
|
1119
1140
|
promise, "unknown", "Unsupported second factor. Only phone factors are supported.");
|
1120
1141
|
return;
|
1121
1142
|
}
|
1122
|
-
|
1143
|
+
FirebaseApp firebaseApp = FirebaseApp.getInstance(appName);
|
1144
|
+
FirebaseAuth firebaseAuth = FirebaseAuth.getInstance(firebaseApp);
|
1123
1145
|
final Activity activity = getCurrentActivity();
|
1124
1146
|
final PhoneAuthOptions phoneAuthOptions =
|
1125
|
-
PhoneAuthOptions.newBuilder()
|
1147
|
+
PhoneAuthOptions.newBuilder(firebaseAuth)
|
1126
1148
|
.setActivity(activity)
|
1127
1149
|
.setMultiFactorHint((PhoneMultiFactorInfo) selectedHint)
|
1128
1150
|
.setTimeout(30L, TimeUnit.SECONDS)
|
@@ -1163,9 +1185,10 @@ class ReactNativeFirebaseAuthModule extends ReactNativeFirebaseModule {
|
|
1163
1185
|
rejectPromiseWithCodeAndMessage(promise, "unknown", "can't find session for provided key");
|
1164
1186
|
return;
|
1165
1187
|
}
|
1166
|
-
|
1188
|
+
FirebaseApp firebaseApp = FirebaseApp.getInstance(appName);
|
1189
|
+
FirebaseAuth firebaseAuth = FirebaseAuth.getInstance(firebaseApp);
|
1167
1190
|
final PhoneAuthOptions phoneAuthOptions =
|
1168
|
-
PhoneAuthOptions.newBuilder()
|
1191
|
+
PhoneAuthOptions.newBuilder(firebaseAuth)
|
1169
1192
|
.setPhoneNumber(phoneNumber)
|
1170
1193
|
.setActivity(getCurrentActivity())
|
1171
1194
|
.setTimeout(30L, TimeUnit.SECONDS)
|
@@ -19,6 +19,7 @@
|
|
19
19
|
#import <React/RCTUtils.h>
|
20
20
|
|
21
21
|
#import "RNFBApp/RCTConvert+FIRApp.h"
|
22
|
+
#import "RNFBApp/RNFBAppModule.h"
|
22
23
|
#import "RNFBApp/RNFBSharedUtils.h"
|
23
24
|
#import "RNFBAuthModule.h"
|
24
25
|
|
@@ -159,6 +160,21 @@ RCT_EXPORT_METHOD(removeIdTokenListener : (FIRApp *)firebaseApp) {
|
|
159
160
|
}
|
160
161
|
}
|
161
162
|
|
163
|
+
RCT_EXPORT_METHOD(configureAuthDomain : (FIRApp *)firebaseApp) {
|
164
|
+
NSString *authDomain = [RNFBAppModule getCustomDomain:firebaseApp.name];
|
165
|
+
DLog(@"RNFBAuth app: %@ customAuthDomain: %@", firebaseApp.name, authDomain);
|
166
|
+
if (authDomain != nil) {
|
167
|
+
[FIRAuth authWithApp:firebaseApp].customAuthDomain = authDomain;
|
168
|
+
}
|
169
|
+
}
|
170
|
+
|
171
|
+
RCT_EXPORT_METHOD(getCustomAuthDomain
|
172
|
+
: (FIRApp *)firebaseApp
|
173
|
+
: (RCTPromiseResolveBlock)resolve
|
174
|
+
: (RCTPromiseRejectBlock)reject) {
|
175
|
+
resolve([FIRAuth authWithApp:firebaseApp].customAuthDomain);
|
176
|
+
}
|
177
|
+
|
162
178
|
RCT_EXPORT_METHOD(setAppVerificationDisabledForTesting : (FIRApp *)firebaseApp : (BOOL)disabled) {
|
163
179
|
[FIRAuth authWithApp:firebaseApp].settings.appVerificationDisabledForTesting = disabled;
|
164
180
|
}
|
@@ -291,9 +307,8 @@ RCT_EXPORT_METHOD(reload
|
|
291
307
|
: (RCTPromiseResolveBlock)resolve
|
292
308
|
: (RCTPromiseRejectBlock)reject) {
|
293
309
|
FIRUser *user = [FIRAuth authWithApp:firebaseApp].currentUser;
|
294
|
-
|
295
310
|
if (user) {
|
296
|
-
[self reloadAndReturnUser:user resolver:resolve rejecter:reject];
|
311
|
+
[self reloadAndReturnUser:user resolver:resolve rejecter:reject firebaseApp:firebaseApp];
|
297
312
|
} else {
|
298
313
|
[self promiseNoUser:resolve rejecter:reject isError:YES];
|
299
314
|
}
|
@@ -367,7 +382,10 @@ RCT_EXPORT_METHOD(updateEmail
|
|
367
382
|
if (error) {
|
368
383
|
[self promiseRejectAuthException:reject error:error];
|
369
384
|
} else {
|
370
|
-
[self reloadAndReturnUser:user
|
385
|
+
[self reloadAndReturnUser:user
|
386
|
+
resolver:resolve
|
387
|
+
rejecter:reject
|
388
|
+
firebaseApp:firebaseApp];
|
371
389
|
}
|
372
390
|
}];
|
373
391
|
} else {
|
@@ -410,7 +428,8 @@ RCT_EXPORT_METHOD(updatePhoneNumber
|
|
410
428
|
FIRPhoneAuthCredential *credential =
|
411
429
|
(FIRPhoneAuthCredential *)[self getCredentialForProvider:provider
|
412
430
|
token:authToken
|
413
|
-
secret:authSecret
|
431
|
+
secret:authSecret
|
432
|
+
firebaseApp:firebaseApp];
|
414
433
|
|
415
434
|
if (credential == nil) {
|
416
435
|
[RNFBSharedUtils
|
@@ -465,7 +484,7 @@ RCT_EXPORT_METHOD(updateProfile
|
|
465
484
|
if (error) {
|
466
485
|
[self promiseRejectAuthException:reject error:error];
|
467
486
|
} else {
|
468
|
-
[self reloadAndReturnUser:user resolver:resolve rejecter:reject];
|
487
|
+
[self reloadAndReturnUser:user resolver:resolve rejecter:reject firebaseApp:firebaseApp];
|
469
488
|
}
|
470
489
|
}];
|
471
490
|
} else {
|
@@ -549,8 +568,8 @@ RCT_EXPORT_METHOD(signInWithCredential
|
|
549
568
|
: (RCTPromiseRejectBlock)reject) {
|
550
569
|
FIRAuthCredential *credential = [self getCredentialForProvider:provider
|
551
570
|
token:authToken
|
552
|
-
secret:authSecret
|
553
|
-
|
571
|
+
secret:authSecret
|
572
|
+
firebaseApp:firebaseApp];
|
554
573
|
if (credential == nil) {
|
555
574
|
[RNFBSharedUtils rejectPromiseWithUserInfo:reject
|
556
575
|
userInfo:(NSMutableDictionary *)@{
|
@@ -559,8 +578,7 @@ RCT_EXPORT_METHOD(signInWithCredential
|
|
559
578
|
@"has expired or is not currently supported.",
|
560
579
|
}];
|
561
580
|
}
|
562
|
-
|
563
|
-
[[FIRAuth authWithApp:firebaseApp]
|
581
|
+
DLog(@"using app SignInWithCredential: %@", firebaseApp.name)[[FIRAuth authWithApp:firebaseApp]
|
564
582
|
signInWithCredential:credential
|
565
583
|
completion:^(FIRAuthDataResult *authResult, NSError *error) {
|
566
584
|
if (error) {
|
@@ -586,7 +604,8 @@ RCT_EXPORT_METHOD(signInWithProvider
|
|
586
604
|
}];
|
587
605
|
}
|
588
606
|
|
589
|
-
__block FIROAuthProvider *builder =
|
607
|
+
__block FIROAuthProvider *builder =
|
608
|
+
[FIROAuthProvider providerWithProviderID:providerId auth:[FIRAuth authWithApp:firebaseApp]];
|
590
609
|
// Add scopes if present
|
591
610
|
if (provider[@"scopes"]) {
|
592
611
|
[builder setScopes:provider[@"scopes"]];
|
@@ -604,7 +623,7 @@ RCT_EXPORT_METHOD(signInWithProvider
|
|
604
623
|
return;
|
605
624
|
}
|
606
625
|
if (credential) {
|
607
|
-
[[FIRAuth
|
626
|
+
[[FIRAuth authWithApp:firebaseApp]
|
608
627
|
signInWithCredential:credential
|
609
628
|
completion:^(FIRAuthDataResult *_Nullable authResult,
|
610
629
|
NSError *_Nullable error) {
|
@@ -801,7 +820,8 @@ RCT_EXPORT_METHOD(signInWithPhoneNumber
|
|
801
820
|
: (NSString *)phoneNumber
|
802
821
|
: (RCTPromiseResolveBlock)resolve
|
803
822
|
: (RCTPromiseRejectBlock)reject) {
|
804
|
-
|
823
|
+
DLog(@"SignInWthPhoneNumber instance: %@",
|
824
|
+
firebaseApp.name)[[FIRPhoneAuthProvider providerWithAuth:[FIRAuth authWithApp:firebaseApp]]
|
805
825
|
verifyPhoneNumber:phoneNumber
|
806
826
|
UIDelegate:nil
|
807
827
|
completion:^(NSString *_Nullable verificationID, NSError *_Nullable error) {
|
@@ -842,8 +862,8 @@ RCT_EXPORT_METHOD(verifyPhoneNumberWithMultiFactorInfo
|
|
842
862
|
}];
|
843
863
|
return;
|
844
864
|
}
|
845
|
-
|
846
|
-
|
865
|
+
DLog(@"using instance verifyPhoneNumberWithMultiFactorInfo: %@",
|
866
|
+
firebaseApp.name)[[FIRPhoneAuthProvider providerWithAuth:[FIRAuth authWithApp:firebaseApp]]
|
847
867
|
verifyPhoneNumberWithMultiFactorInfo:hint
|
848
868
|
UIDelegate:nil
|
849
869
|
multiFactorSession:session
|
@@ -852,7 +872,8 @@ RCT_EXPORT_METHOD(verifyPhoneNumberWithMultiFactorInfo
|
|
852
872
|
if (error) {
|
853
873
|
[self promiseRejectAuthException:reject error:error];
|
854
874
|
} else {
|
855
|
-
|
875
|
+
DLog(@"verificationID: %@", verificationID)
|
876
|
+
resolve(verificationID);
|
856
877
|
}
|
857
878
|
}];
|
858
879
|
}
|
@@ -864,7 +885,8 @@ RCT_EXPORT_METHOD(verifyPhoneNumberForMultiFactor
|
|
864
885
|
: (RCTPromiseResolveBlock)resolve
|
865
886
|
: (RCTPromiseRejectBlock)reject) {
|
866
887
|
FIRMultiFactorSession *session = cachedSessions[sessionId];
|
867
|
-
|
888
|
+
DLog(@"using instance VerifyPhoneNumberForMultifactor: %@",
|
889
|
+
firebaseApp.name)[[FIRPhoneAuthProvider providerWithAuth:[FIRAuth authWithApp:firebaseApp]]
|
868
890
|
verifyPhoneNumber:phoneNumber
|
869
891
|
UIDelegate:nil
|
870
892
|
multiFactorSession:session
|
@@ -885,19 +907,22 @@ RCT_EXPORT_METHOD(resolveMultiFactorSignIn
|
|
885
907
|
: (NSString *)verificationCode
|
886
908
|
: (RCTPromiseResolveBlock)resolve
|
887
909
|
: (RCTPromiseRejectBlock)reject) {
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
910
|
+
DLog(@"using instance resolve MultiFactorSignIn: %@", firebaseApp.name)
|
911
|
+
FIRPhoneAuthCredential *credential =
|
912
|
+
[[FIRPhoneAuthProvider providerWithAuth:[FIRAuth authWithApp:firebaseApp]]
|
913
|
+
credentialWithVerificationID:verificationId
|
914
|
+
verificationCode:verificationCode];
|
915
|
+
DLog(@"credential: %@", credential) FIRMultiFactorAssertion *assertion =
|
893
916
|
[FIRPhoneMultiFactorGenerator assertionWithCredential:credential];
|
917
|
+
|
894
918
|
[cachedResolver[sessionKey] resolveSignInWithAssertion:assertion
|
895
919
|
completion:^(FIRAuthDataResult *_Nullable authResult,
|
896
920
|
NSError *_Nullable error) {
|
897
|
-
if (error) {
|
921
|
+
DLog(@"authError: %@", error) if (error) {
|
898
922
|
[self promiseRejectAuthException:reject
|
899
923
|
error:error];
|
900
|
-
}
|
924
|
+
}
|
925
|
+
else {
|
901
926
|
[self promiseWithAuthResult:resolve
|
902
927
|
rejecter:reject
|
903
928
|
authResult:authResult];
|
@@ -930,9 +955,11 @@ RCT_EXPORT_METHOD(finalizeMultiFactorEnrollment
|
|
930
955
|
: (NSString *_Nullable)displayName
|
931
956
|
: (RCTPromiseResolveBlock)resolve
|
932
957
|
: (RCTPromiseRejectBlock)reject) {
|
933
|
-
|
934
|
-
|
935
|
-
|
958
|
+
DLog(@"using instance finalizeMultifactorEnrollment: %@", firebaseApp.name)
|
959
|
+
FIRPhoneAuthCredential *credential =
|
960
|
+
[[FIRPhoneAuthProvider providerWithAuth:[FIRAuth authWithApp:firebaseApp]]
|
961
|
+
credentialWithVerificationID:verificationId
|
962
|
+
verificationCode:verificationCode];
|
936
963
|
FIRMultiFactorAssertion *assertion =
|
937
964
|
[FIRPhoneMultiFactorGenerator assertionWithCredential:credential];
|
938
965
|
FIRUser *user = [FIRAuth authWithApp:firebaseApp].currentUser;
|
@@ -953,12 +980,13 @@ RCT_EXPORT_METHOD(verifyPhoneNumber
|
|
953
980
|
: (FIRApp *)firebaseApp
|
954
981
|
: (NSString *)phoneNumber
|
955
982
|
: (NSString *)requestKey) {
|
956
|
-
|
983
|
+
DLog(@"using instance verifyPhoneNumber: %@",
|
984
|
+
firebaseApp.name)[[FIRPhoneAuthProvider providerWithAuth:[FIRAuth authWithApp:firebaseApp]]
|
957
985
|
verifyPhoneNumber:phoneNumber
|
958
986
|
UIDelegate:nil
|
959
987
|
completion:^(NSString *_Nullable verificationID, NSError *_Nullable error) {
|
960
988
|
if (error) {
|
961
|
-
NSDictionary *jsError = [self getJSError:
|
989
|
+
NSDictionary *jsError = [self getJSError:error];
|
962
990
|
NSDictionary *body = @{
|
963
991
|
@"type" : @"onVerificationFailed",
|
964
992
|
@"requestKey" : requestKey,
|
@@ -991,12 +1019,14 @@ RCT_EXPORT_METHOD(confirmationResultConfirm
|
|
991
1019
|
NSString *verificationId = [defaults stringForKey:@"authVerificationID"];
|
992
1020
|
|
993
1021
|
FIRAuthCredential *credential =
|
994
|
-
[[FIRPhoneAuthProvider
|
995
|
-
|
1022
|
+
[[FIRPhoneAuthProvider providerWithAuth:[FIRAuth authWithApp:firebaseApp]]
|
1023
|
+
credentialWithVerificationID:verificationId
|
1024
|
+
verificationCode:verificationCode];
|
996
1025
|
|
997
1026
|
[[FIRAuth authWithApp:firebaseApp]
|
998
1027
|
signInWithCredential:credential
|
999
1028
|
completion:^(FIRAuthDataResult *authResult, NSError *error) {
|
1029
|
+
DLog(@"auth error: %long", (long)error.code);
|
1000
1030
|
if (error) {
|
1001
1031
|
[self promiseRejectAuthException:reject error:error];
|
1002
1032
|
} else {
|
@@ -1014,7 +1044,8 @@ RCT_EXPORT_METHOD(linkWithCredential
|
|
1014
1044
|
: (RCTPromiseRejectBlock)reject) {
|
1015
1045
|
FIRAuthCredential *credential = [self getCredentialForProvider:provider
|
1016
1046
|
token:authToken
|
1017
|
-
secret:authSecret
|
1047
|
+
secret:authSecret
|
1048
|
+
firebaseApp:firebaseApp];
|
1018
1049
|
|
1019
1050
|
if (credential == nil) {
|
1020
1051
|
[RNFBSharedUtils rejectPromiseWithUserInfo:reject
|
@@ -1061,7 +1092,8 @@ RCT_EXPORT_METHOD(linkWithProvider
|
|
1061
1092
|
return;
|
1062
1093
|
}
|
1063
1094
|
|
1064
|
-
__block FIROAuthProvider *builder =
|
1095
|
+
__block FIROAuthProvider *builder =
|
1096
|
+
[FIROAuthProvider providerWithProviderID:providerId auth:[FIRAuth authWithApp:firebaseApp]];
|
1065
1097
|
// Add scopes if present
|
1066
1098
|
if (provider[@"scopes"]) {
|
1067
1099
|
[builder setScopes:provider[@"scopes"]];
|
@@ -1115,7 +1147,10 @@ RCT_EXPORT_METHOD(unlink
|
|
1115
1147
|
if (error) {
|
1116
1148
|
[self promiseRejectAuthException:reject error:error];
|
1117
1149
|
} else {
|
1118
|
-
[self reloadAndReturnUser:user
|
1150
|
+
[self reloadAndReturnUser:user
|
1151
|
+
resolver:resolve
|
1152
|
+
rejecter:reject
|
1153
|
+
firebaseApp:firebaseApp];
|
1119
1154
|
}
|
1120
1155
|
}];
|
1121
1156
|
} else {
|
@@ -1132,7 +1167,8 @@ RCT_EXPORT_METHOD(reauthenticateWithCredential
|
|
1132
1167
|
: (RCTPromiseRejectBlock)reject) {
|
1133
1168
|
FIRAuthCredential *credential = [self getCredentialForProvider:provider
|
1134
1169
|
token:authToken
|
1135
|
-
secret:authSecret
|
1170
|
+
secret:authSecret
|
1171
|
+
firebaseApp:firebaseApp];
|
1136
1172
|
|
1137
1173
|
if (credential == nil) {
|
1138
1174
|
[RNFBSharedUtils rejectPromiseWithUserInfo:reject
|
@@ -1183,7 +1219,8 @@ RCT_EXPORT_METHOD(reauthenticateWithProvider
|
|
1183
1219
|
return;
|
1184
1220
|
}
|
1185
1221
|
|
1186
|
-
__block FIROAuthProvider *builder =
|
1222
|
+
__block FIROAuthProvider *builder =
|
1223
|
+
[FIROAuthProvider providerWithProviderID:providerId auth:[FIRAuth authWithApp:firebaseApp]];
|
1187
1224
|
// Add scopes if present
|
1188
1225
|
if (provider[@"scopes"]) {
|
1189
1226
|
[builder setScopes:provider[@"scopes"]];
|
@@ -1289,7 +1326,8 @@ RCT_EXPORT_METHOD(useEmulator
|
|
1289
1326
|
|
1290
1327
|
- (FIRAuthCredential *)getCredentialForProvider:(NSString *)provider
|
1291
1328
|
token:(NSString *)authToken
|
1292
|
-
secret:(NSString *)authTokenSecret
|
1329
|
+
secret:(NSString *)authTokenSecret
|
1330
|
+
firebaseApp:(FIRApp *)firebaseApp {
|
1293
1331
|
FIRAuthCredential *credential;
|
1294
1332
|
|
1295
1333
|
// First check if we cached an authToken
|
@@ -1318,8 +1356,10 @@ RCT_EXPORT_METHOD(useEmulator
|
|
1318
1356
|
} else if ([provider compare:@"github.com" options:NSCaseInsensitiveSearch] == NSOrderedSame) {
|
1319
1357
|
credential = [FIRGitHubAuthProvider credentialWithToken:authToken];
|
1320
1358
|
} else if ([provider compare:@"phone" options:NSCaseInsensitiveSearch] == NSOrderedSame) {
|
1321
|
-
|
1322
|
-
|
1359
|
+
DLog(@"using app credGen: %@", firebaseApp.name) credential =
|
1360
|
+
[[FIRPhoneAuthProvider providerWithAuth:[FIRAuth authWithApp:firebaseApp]]
|
1361
|
+
credentialWithVerificationID:authToken
|
1362
|
+
verificationCode:authTokenSecret];
|
1323
1363
|
} else if ([provider compare:@"oauth" options:NSCaseInsensitiveSearch] == NSOrderedSame) {
|
1324
1364
|
credential = [FIROAuthProvider credentialWithProviderID:@"oauth"
|
1325
1365
|
IDToken:authToken
|
@@ -1339,7 +1379,8 @@ RCT_EXPORT_METHOD(useEmulator
|
|
1339
1379
|
// correctly refresh the user object when performing certain operations
|
1340
1380
|
- (void)reloadAndReturnUser:(FIRUser *)user
|
1341
1381
|
resolver:(RCTPromiseResolveBlock)resolve
|
1342
|
-
rejecter:(RCTPromiseRejectBlock)reject
|
1382
|
+
rejecter:(RCTPromiseRejectBlock)reject
|
1383
|
+
firebaseApp:(FIRApp *)firebaseApp {
|
1343
1384
|
[user reloadWithCompletion:^(NSError *_Nullable error) {
|
1344
1385
|
if (error) {
|
1345
1386
|
[self promiseRejectAuthException:reject error:error];
|
@@ -1370,6 +1411,7 @@ RCT_EXPORT_METHOD(useEmulator
|
|
1370
1411
|
return @{
|
1371
1412
|
@"hints" : [self convertMultiFactorData:resolver.hints],
|
1372
1413
|
@"session" : sessionHash,
|
1414
|
+
@"auth" : resolver.auth
|
1373
1415
|
};
|
1374
1416
|
}
|
1375
1417
|
|
@@ -1383,7 +1425,7 @@ RCT_EXPORT_METHOD(useEmulator
|
|
1383
1425
|
}
|
1384
1426
|
|
1385
1427
|
- (void)promiseRejectAuthException:(RCTPromiseRejectBlock)reject error:(NSError *)error {
|
1386
|
-
NSDictionary *jsError = [self getJSError:
|
1428
|
+
NSDictionary *jsError = [self getJSError:error];
|
1387
1429
|
|
1388
1430
|
[RNFBSharedUtils
|
1389
1431
|
rejectPromiseWithUserInfo:reject
|
@@ -1483,8 +1525,7 @@ RCT_EXPORT_METHOD(useEmulator
|
|
1483
1525
|
|
1484
1526
|
NSDictionary *resolverDict = nil;
|
1485
1527
|
if ([error userInfo][FIRAuthErrorUserInfoMultiFactorResolverKey] != nil) {
|
1486
|
-
FIRMultiFactorResolver *resolver =
|
1487
|
-
(FIRMultiFactorResolver *)error.userInfo[FIRAuthErrorUserInfoMultiFactorResolverKey];
|
1528
|
+
FIRMultiFactorResolver *resolver = error.userInfo[FIRAuthErrorUserInfoMultiFactorResolverKey];
|
1488
1529
|
resolverDict = [self multiFactorResolverToDict:resolver];
|
1489
1530
|
|
1490
1531
|
NSString *sessionKey = [NSString stringWithFormat:@"%@", @([resolver.session hash])];
|
@@ -1704,4 +1745,4 @@ RCT_EXPORT_METHOD(useEmulator
|
|
1704
1745
|
return settings;
|
1705
1746
|
}
|
1706
1747
|
|
1707
|
-
@end
|
1748
|
+
@end
|
package/lib/index.d.ts
CHANGED
@@ -241,11 +241,11 @@ export namespace FirebaseAuthTypes {
|
|
241
241
|
*/
|
242
242
|
export interface PhoneAuthState {
|
243
243
|
/**
|
244
|
-
*
|
244
|
+
* SMS message with verification code sent to phone number.
|
245
245
|
*/
|
246
246
|
CODE_SENT: 'sent';
|
247
247
|
/**
|
248
|
-
*
|
248
|
+
* The timeout specified in {@link auth#verifyPhoneNumber} has expired.
|
249
249
|
*/
|
250
250
|
AUTO_VERIFY_TIMEOUT: 'timeout';
|
251
251
|
/**
|
package/lib/index.js
CHANGED
@@ -56,6 +56,7 @@ export {
|
|
56
56
|
fetchSignInMethodsForEmail,
|
57
57
|
getAdditionalUserInfo,
|
58
58
|
getAuth,
|
59
|
+
getCustomAuthDomain,
|
59
60
|
getIdToken,
|
60
61
|
getIdTokenResult,
|
61
62
|
getMultiFactorResolver,
|
@@ -173,6 +174,12 @@ class FirebaseAuthModule extends FirebaseModule {
|
|
173
174
|
|
174
175
|
this.native.addAuthStateListener();
|
175
176
|
this.native.addIdTokenListener();
|
177
|
+
|
178
|
+
// custom authDomain in only available from App's FirebaseOptions,
|
179
|
+
// but we need it in Auth if it exists. During app configuration we store
|
180
|
+
// mappings from app name to authDomain, this auth constructor
|
181
|
+
// is a reasonable time to use the mapping and set it into auth natively
|
182
|
+
this.native.configureAuthDomain();
|
176
183
|
}
|
177
184
|
|
178
185
|
get languageCode() {
|
@@ -500,6 +507,10 @@ class FirebaseAuthModule extends FirebaseModule {
|
|
500
507
|
}
|
501
508
|
return new MultiFactorUser(this, user);
|
502
509
|
}
|
510
|
+
|
511
|
+
getCustomAuthDomain() {
|
512
|
+
return this.native.getCustomAuthDomain();
|
513
|
+
}
|
503
514
|
}
|
504
515
|
|
505
516
|
// import { SDK_VERSION } from '@react-native-firebase/auth';
|
package/lib/modular/index.js
CHANGED
@@ -467,3 +467,8 @@ export async function verifyBeforeUpdateEmail(user, newEmail, actionCodeSettings
|
|
467
467
|
export function getAdditionalUserInfo(userCredential) {
|
468
468
|
return userCredential.additionalUserInfo;
|
469
469
|
}
|
470
|
+
|
471
|
+
export function getCustomAuthDomain(auth) {
|
472
|
+
const _auth = _getUnderlyingAuth(auth);
|
473
|
+
return _auth.getCustomAuthDomain();
|
474
|
+
}
|
package/lib/version.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
// Generated by genversion.
|
2
|
-
module.exports = '18.
|
2
|
+
module.exports = '18.9.0';
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@react-native-firebase/auth",
|
3
|
-
"version": "18.
|
3
|
+
"version": "18.9.0",
|
4
4
|
"author": "Invertase <oss@invertase.io> (http://invertase.io)",
|
5
5
|
"description": "React Native Firebase - The authentication module provides an easy-to-use API to integrate an authentication workflow into new and existing applications. React Native Firebase provides access to all Firebase authentication methods and identity providers.",
|
6
6
|
"main": "lib/index.js",
|
@@ -27,7 +27,7 @@
|
|
27
27
|
"plist": "^3.1.0"
|
28
28
|
},
|
29
29
|
"peerDependencies": {
|
30
|
-
"@react-native-firebase/app": "18.
|
30
|
+
"@react-native-firebase/app": "18.9.0",
|
31
31
|
"expo": ">=47.0.0"
|
32
32
|
},
|
33
33
|
"devDependencies": {
|
@@ -42,5 +42,5 @@
|
|
42
42
|
"publishConfig": {
|
43
43
|
"access": "public"
|
44
44
|
},
|
45
|
-
"gitHead": "
|
45
|
+
"gitHead": "695265641dcf2243ab9f27b25776f11616225f68"
|
46
46
|
}
|