@react-native-firebase/auth 18.7.2 → 18.8.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 CHANGED
@@ -3,6 +3,20 @@
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.8.0](https://github.com/invertase/react-native-firebase/compare/v18.7.3...v18.8.0) (2024-01-25)
7
+
8
+ ### Features
9
+
10
+ - **auth, authDomain:** implement FirebaseOptions.authDomain on Auth ([a1f4710](https://github.com/invertase/react-native-firebase/commit/a1f471029352b7597d7e83a8c1ea06145768cf89))
11
+
12
+ ### Bug Fixes
13
+
14
+ - **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))
15
+
16
+ ## [18.7.3](https://github.com/invertase/react-native-firebase/compare/v18.7.2...v18.7.3) (2023-12-13)
17
+
18
+ **Note:** Version bump only for package @react-native-firebase/auth
19
+
6
20
  ## [18.7.2](https://github.com/invertase/react-native-firebase/compare/v18.7.1...v18.7.2) (2023-12-08)
7
21
 
8
22
  **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) {
@@ -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
  }
@@ -1649,7 +1665,7 @@ RCT_EXPORT_METHOD(useEmulator
1649
1665
  [[[NSISO8601DateFormatter alloc] init] stringFromDate:hint.enrollmentDate];
1650
1666
  [enrolledFactors addObject:@{
1651
1667
  @"uid" : hint.UID,
1652
- @"factorId" : [self getJSFactorId:(hint.factorID)],
1668
+ @"factorId" : hint.factorID == nil ? [NSNull null] : [self getJSFactorId:(hint.factorID)],
1653
1669
  @"displayName" : hint.displayName == nil ? [NSNull null] : hint.displayName,
1654
1670
  @"enrollmentDate" : enrollmentDate,
1655
1671
  }];
package/lib/index.d.ts CHANGED
@@ -241,11 +241,11 @@ export namespace FirebaseAuthTypes {
241
241
  */
242
242
  export interface PhoneAuthState {
243
243
  /**
244
- * The timeout specified in {@link auth#verifyPhoneNumber} has expired.
244
+ * SMS message with verification code sent to phone number.
245
245
  */
246
246
  CODE_SENT: 'sent';
247
247
  /**
248
- * SMS message with verification code sent to phone number.
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';
@@ -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.7.2';
2
+ module.exports = '18.8.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-firebase/auth",
3
- "version": "18.7.2",
3
+ "version": "18.8.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.7.2",
30
+ "@react-native-firebase/app": "18.8.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": "bd63b4ba676cecfa74e509438c7442ac2c7c0540"
45
+ "gitHead": "970756d733e1c4642b53d91c5b1b8f58a8f5dbc0"
46
46
  }