@react-native-firebase/auth 21.13.0 → 22.0.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,29 @@
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
+ ## [22.0.0](https://github.com/invertase/react-native-firebase/compare/v21.14.0...v22.0.0) (2025-04-25)
7
+
8
+ ### ⚠ BREAKING CHANGES
9
+
10
+ - **auth:** return type of auth isSignInWithEmailLink changed from boolean to Promise<boolean>
11
+
12
+ ### Features
13
+
14
+ - **auth:** use native isSignInWithEmailLink - returns Promise<boolean> vs boolean ([#8450](https://github.com/invertase/react-native-firebase/issues/8450)) ([3785690](https://github.com/invertase/react-native-firebase/commit/37856901323d81ee8b232bfa0279b6606dbf366d))
15
+
16
+ ### Bug Fixes
17
+
18
+ - **analytics:** Type defs ([#8363](https://github.com/invertase/react-native-firebase/issues/8363)) ([74efc84](https://github.com/invertase/react-native-firebase/commit/74efc848e3ecda47b5c7cdf79e5e72370cd10b7d))
19
+ - **android:** use `=` assignment vs deprecated space-assignment ([39c2ecb](https://github.com/invertase/react-native-firebase/commit/39c2ecb0069a8a5a65b04fb7f86ccecf83273868))
20
+ - **auth:** Make REVERSED_CLIENT_ID optional ([#8470](https://github.com/invertase/react-native-firebase/issues/8470)) ([a909d1b](https://github.com/invertase/react-native-firebase/commit/a909d1beb597dcb92035a2ee6e66995c3aee8a5a))
21
+ - enable provenance signing during publish ([4535f0d](https://github.com/invertase/react-native-firebase/commit/4535f0d5756c89aeb8f8e772348c71d8176348be))
22
+
23
+ ## [21.14.0](https://github.com/invertase/react-native-firebase/compare/v21.13.0...v21.14.0) (2025-04-14)
24
+
25
+ ### Bug Fixes
26
+
27
+ - **auth:** correct modular AuthListenerCallback type ([#8436](https://github.com/invertase/react-native-firebase/issues/8436)) ([d94a2d8](https://github.com/invertase/react-native-firebase/commit/d94a2d8e3786b69eb43d18eb0f329e5492ceaeb1))
28
+
6
29
  ## [21.13.0](https://github.com/invertase/react-native-firebase/compare/v21.12.3...v21.13.0) (2025-03-31)
7
30
 
8
31
  ### Features
@@ -61,20 +61,20 @@ project.ext {
61
61
  android {
62
62
  def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')[0].toInteger()
63
63
  if (agpVersion >= 7) {
64
- namespace 'io.invertase.firebase.auth'
64
+ namespace = 'io.invertase.firebase.auth'
65
65
  }
66
66
 
67
67
  defaultConfig {
68
- multiDexEnabled true
68
+ multiDexEnabled = true
69
69
  }
70
70
  lintOptions {
71
71
  disable 'GradleCompatible'
72
- abortOnError false
72
+ abortOnError = false
73
73
  }
74
74
  if (agpVersion < 8) {
75
75
  compileOptions {
76
- sourceCompatibility JavaVersion.VERSION_11
77
- targetCompatibility JavaVersion.VERSION_11
76
+ sourceCompatibility = JavaVersion.VERSION_11
77
+ targetCompatibility = JavaVersion.VERSION_11
78
78
  }
79
79
  }
80
80
  }
@@ -402,6 +402,20 @@ class ReactNativeFirebaseAuthModule extends ReactNativeFirebaseModule {
402
402
  });
403
403
  }
404
404
 
405
+ /**
406
+ * isSignInWithEmailLink
407
+ *
408
+ * @param email
409
+ * @param promise
410
+ */
411
+ @ReactMethod
412
+ public void isSignInWithEmailLink(String appName, String emailLink, final Promise promise) {
413
+ Log.d(TAG, "isSignInWithEmailLink");
414
+ FirebaseApp firebaseApp = FirebaseApp.getInstance(appName);
415
+ FirebaseAuth firebaseAuth = FirebaseAuth.getInstance(firebaseApp);
416
+ promise.resolve(firebaseAuth.isSignInWithEmailLink(emailLink));
417
+ }
418
+
405
419
  /**
406
420
  * signInWithEmailAndPassword
407
421
  *
@@ -254,6 +254,15 @@ RCT_EXPORT_METHOD(signInWithEmailAndPassword
254
254
  }];
255
255
  }
256
256
 
257
+ RCT_EXPORT_METHOD(isSignInWithEmailLink
258
+ : (FIRApp *)firebaseApp
259
+ : (NSString *)emailLink
260
+ : (RCTPromiseResolveBlock)resolve
261
+ : (RCTPromiseRejectBlock)reject) {
262
+ resolve(
263
+ @([RCTConvert BOOL:@([[FIRAuth authWithApp:firebaseApp] isSignInWithEmailLink:emailLink])]));
264
+ }
265
+
257
266
  RCT_EXPORT_METHOD(signInWithEmailLink
258
267
  : (FIRApp *)firebaseApp
259
268
  : (NSString *)email
package/lib/index.d.ts CHANGED
@@ -2013,12 +2013,12 @@ export namespace FirebaseAuthTypes {
2013
2013
  * #### Example
2014
2014
  *
2015
2015
  * ```js
2016
- * const signedInWithLink = firebase.auth().isSignInWithEmailLink(link);
2016
+ * const signedInWithLink = await firebase.auth().isSignInWithEmailLink(link);
2017
2017
  * ```
2018
2018
  *
2019
2019
  * @param emailLink The email link to check whether the user signed in with it.
2020
2020
  */
2021
- isSignInWithEmailLink(emailLink: string): boolean;
2021
+ isSignInWithEmailLink(emailLink: string): Promise<boolean>;
2022
2022
 
2023
2023
  /**
2024
2024
  * Signs the user in with an email link.
package/lib/index.js CHANGED
@@ -361,11 +361,7 @@ class FirebaseAuthModule extends FirebaseModule {
361
361
  }
362
362
 
363
363
  isSignInWithEmailLink(emailLink) {
364
- return (
365
- typeof emailLink === 'string' &&
366
- (emailLink.includes('mode=signIn') || emailLink.includes('mode%3DsignIn')) &&
367
- (emailLink.includes('oobCode=') || emailLink.includes('oobCode%3D'))
368
- );
364
+ return this.native.isSignInWithEmailLink(emailLink);
369
365
  }
370
366
 
371
367
  signInWithEmailLink(email, emailLink) {
@@ -16,7 +16,7 @@
16
16
  */
17
17
 
18
18
  import { ReactNativeFirebase } from '@react-native-firebase/app';
19
- import { FirebaseAuthTypes, CallbackOrObserver, AuthListenerCallback } from '../index';
19
+ import { FirebaseAuthTypes, CallbackOrObserver } from '../index';
20
20
  import { firebase } from '..';
21
21
 
22
22
  import Auth = FirebaseAuthTypes.Module;
@@ -169,9 +169,9 @@ export function initializeRecaptchaConfig(auth: Auth): Promise<void>;
169
169
  *
170
170
  * @param auth - The Auth instance.
171
171
  * @param emailLink - The email link to check.
172
- * @returns True if the link is a sign-in with email link.
172
+ * @returns A promise that resolves if the link is a sign-in with email link.
173
173
  */
174
- export function isSignInWithEmailLink(auth: Auth, emailLink: string): boolean;
174
+ export function isSignInWithEmailLink(auth: Auth, emailLink: string): Promise<boolean>;
175
175
 
176
176
  /**
177
177
  * Adds an observer for changes to the user's sign-in state.
@@ -182,7 +182,7 @@ export function isSignInWithEmailLink(auth: Auth, emailLink: string): boolean;
182
182
  */
183
183
  export function onAuthStateChanged(
184
184
  auth: Auth,
185
- nextOrObserver: CallbackOrObserver<AuthListenerCallback>,
185
+ nextOrObserver: CallbackOrObserver<FirebaseAuthTypes.AuthListenerCallback>,
186
186
  ): () => void;
187
187
 
188
188
  /**
@@ -194,7 +194,7 @@ export function onAuthStateChanged(
194
194
  */
195
195
  export function onIdTokenChanged(
196
196
  auth: Auth,
197
- nextOrObserver: CallbackOrObserver<AuthListenerCallback>,
197
+ nextOrObserver: CallbackOrObserver<FirebaseAuthTypes.AuthListenerCallback>,
198
198
  ): () => void;
199
199
 
200
200
  /**
@@ -165,7 +165,7 @@ export async function getRedirectResult(auth, resolver) {
165
165
  * Checks if an incoming link is a sign-in with email link suitable for signInWithEmailLink().
166
166
  * @param {Auth} auth - The Auth instance.
167
167
  * @param {string} emailLink - The email link to check.
168
- * @returns {boolean}
168
+ * @returns {Promise<boolean>}
169
169
  */
170
170
  export function isSignInWithEmailLink(auth, emailLink) {
171
171
  return auth.isSignInWithEmailLink(emailLink);
package/lib/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- module.exports = '21.13.0';
2
+ module.exports = '22.0.0';
@@ -10,6 +10,7 @@ import {
10
10
  multiFactor,
11
11
  createUserWithEmailAndPassword,
12
12
  signInWithEmailAndPassword,
13
+ isSignInWithEmailLink,
13
14
  signInWithEmailLink,
14
15
  signInWithCustomToken,
15
16
  sendPasswordResetEmail,
@@ -230,20 +231,18 @@ function getCachedAuthInstance(appName) {
230
231
  // Warn auth persistence is is disabled unless Async Storage implementation is provided.
231
232
  // eslint-disable-next-line no-console
232
233
  console.warn(
233
- ```
234
- Firebase Auth persistence is disabled. To enable persistence, provide an Async Storage implementation.
235
-
236
- For example, to use React Native Async Storage:
237
-
238
- import AsyncStorage from '@react-native-async-storage/async-storage';
239
-
240
- // Before initializing Firebase set the Async Storage implementation
241
- // that will be used to persist user sessions.
242
- firebase.setReactNativeAsyncStorage(AsyncStorage);
243
-
244
- // Then initialize Firebase as normal.
245
- await firebase.initializeApp({ ... });
246
- ```,
234
+ 'Firebase Auth persistence is disabled. To enable persistence, provide an Async Storage implementation.\n' +
235
+ '\n' +
236
+ 'For example, to use React Native Async Storage:\n' +
237
+ '\n' +
238
+ " import AsyncStorage from '@react-native-async-storage/async-storage';\n" +
239
+ '\n' +
240
+ ' // Before initializing Firebase set the Async Storage implementation\n' +
241
+ ' // that will be used to persist user sessions.\n' +
242
+ ' firebase.setReactNativeAsyncStorage(AsyncStorage);\n' +
243
+ '\n' +
244
+ ' // Then initialize Firebase as normal.\n' +
245
+ ' await firebase.initializeApp({ ... });\n',
247
246
  );
248
247
  }
249
248
  instances[appName] = initializeAuth(getApp(appName), {
@@ -449,6 +448,19 @@ export default {
449
448
  });
450
449
  },
451
450
 
451
+ /**
452
+ * Check if a sign in with email link is valid
453
+ * @param {string} appName - The name of the app to get the auth instance for.
454
+ * @param {string} emailLink - The email link to sign in with.
455
+ * @returns {Promise<boolean>} - Whether the link is a valid sign in with email link.
456
+ */
457
+ async isSignInWithEmailLink(appName, emailLink) {
458
+ return guard(async () => {
459
+ const auth = getCachedAuthInstance(appName);
460
+ return await isSignInWithEmailLink(auth, emailLink);
461
+ });
462
+ },
463
+
452
464
  /**
453
465
  * Sign in with email link.
454
466
  * @param {string} appName - The name of the app to get the auth instance for.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-firebase/auth",
3
- "version": "21.13.0",
3
+ "version": "22.0.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,12 +27,12 @@
27
27
  "plist": "^3.1.0"
28
28
  },
29
29
  "peerDependencies": {
30
- "@react-native-firebase/app": "21.13.0",
30
+ "@react-native-firebase/app": "22.0.0",
31
31
  "expo": ">=47.0.0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/plist": "^3.0.5",
35
- "expo": "^52.0.35"
35
+ "expo": "^52.0.46"
36
36
  },
37
37
  "peerDependenciesMeta": {
38
38
  "expo": {
@@ -40,7 +40,8 @@
40
40
  }
41
41
  },
42
42
  "publishConfig": {
43
- "access": "public"
43
+ "access": "public",
44
+ "provenance": true
44
45
  },
45
- "gitHead": "d4d02d15431a0be091a7417833e0180479f5e788"
46
+ "gitHead": "e9fee87b413c90e243347d5c60272f07f41d99b8"
46
47
  }
@@ -21,13 +21,21 @@ function getReversedClientId(googleServiceFilePath) {
21
21
  const googleServicePlist = fs_1.default.readFileSync(googleServiceFilePath, 'utf8');
22
22
  const googleServiceJson = plist_1.default.parse(googleServicePlist);
23
23
  const REVERSED_CLIENT_ID = googleServiceJson.REVERSED_CLIENT_ID;
24
- if (!REVERSED_CLIENT_ID) {
25
- throw new TypeError('REVERSED_CLIENT_ID missing');
26
- }
27
24
  return REVERSED_CLIENT_ID;
28
25
  }
29
26
  catch {
30
- throw new Error('[@react-native-firebase/auth] Failed to parse your GoogleService-Info.plist. Are you sure it is a valid Info.Plist file with a REVERSE_CLIENT_ID field?');
27
+ throw new Error('[@react-native-firebase/auth] Failed to parse your GoogleService-Info.plist. Are you sure it is a valid Info.Plist file with a REVERSED_CLIENT_ID field?');
28
+ }
29
+ }
30
+ // Utility function to make REVERSED_CLIENT_ID optional by only proceeding if it exists in Google-Services.plist
31
+ function reversedClientIDExists(googleServiceFilePath) {
32
+ try {
33
+ const googleServicePlist = fs_1.default.readFileSync(googleServiceFilePath, 'utf8');
34
+ const googleServiceJson = plist_1.default.parse(googleServicePlist);
35
+ return !!googleServiceJson.REVERSED_CLIENT_ID;
36
+ }
37
+ catch {
38
+ return false;
31
39
  }
32
40
  }
33
41
  // add phone auth support by configuring recaptcha
@@ -56,7 +64,13 @@ function setUrlTypesForCaptcha({ config, }) {
56
64
  if (!fs_1.default.existsSync(googleServiceFilePath)) {
57
65
  throw new Error(`[@react-native-firebase/auth] GoogleService-Info.plist doesn't exist in ${googleServiceFilePath}. Place it there or configure the path in app.json`);
58
66
  }
59
- const reversedClientId = getReversedClientId(googleServiceFilePath);
60
- addUriScheme(config, reversedClientId);
67
+ if (reversedClientIDExists(googleServiceFilePath)) {
68
+ const reversedClientId = getReversedClientId(googleServiceFilePath);
69
+ addUriScheme(config, reversedClientId);
70
+ }
71
+ else {
72
+ // eslint-disable-next-line no-console
73
+ console.warn('[@react-native-firebase/auth] REVERSED_CLIENT_ID field not found in GoogleServices-Info.plist. Google Sign-In requires this is - if you need Google Sign-In, enable it and re-download your plist file');
74
+ }
61
75
  return config;
62
76
  }
@@ -23,18 +23,25 @@ function getReversedClientId(googleServiceFilePath: string): string {
23
23
  const googleServiceJson = plist.parse(googleServicePlist) as { REVERSED_CLIENT_ID: string };
24
24
  const REVERSED_CLIENT_ID = googleServiceJson.REVERSED_CLIENT_ID;
25
25
 
26
- if (!REVERSED_CLIENT_ID) {
27
- throw new TypeError('REVERSED_CLIENT_ID missing');
28
- }
29
-
30
26
  return REVERSED_CLIENT_ID;
31
27
  } catch {
32
28
  throw new Error(
33
- '[@react-native-firebase/auth] Failed to parse your GoogleService-Info.plist. Are you sure it is a valid Info.Plist file with a REVERSE_CLIENT_ID field?',
29
+ '[@react-native-firebase/auth] Failed to parse your GoogleService-Info.plist. Are you sure it is a valid Info.Plist file with a REVERSED_CLIENT_ID field?',
34
30
  );
35
31
  }
36
32
  }
37
33
 
34
+ // Utility function to make REVERSED_CLIENT_ID optional by only proceeding if it exists in Google-Services.plist
35
+ function reversedClientIDExists(googleServiceFilePath: string): boolean {
36
+ try {
37
+ const googleServicePlist = fs.readFileSync(googleServiceFilePath, 'utf8');
38
+ const googleServiceJson = plist.parse(googleServicePlist) as { REVERSED_CLIENT_ID: string };
39
+ return !!googleServiceJson.REVERSED_CLIENT_ID;
40
+ } catch {
41
+ return false;
42
+ }
43
+ }
44
+
38
45
  // add phone auth support by configuring recaptcha
39
46
  // https://github.com/invertase/react-native-firebase/pull/6167
40
47
  function addUriScheme(
@@ -84,8 +91,15 @@ export function setUrlTypesForCaptcha({
84
91
  );
85
92
  }
86
93
 
87
- const reversedClientId = getReversedClientId(googleServiceFilePath);
88
- addUriScheme(config, reversedClientId);
94
+ if (reversedClientIDExists(googleServiceFilePath)) {
95
+ const reversedClientId = getReversedClientId(googleServiceFilePath);
96
+ addUriScheme(config, reversedClientId);
97
+ } else {
98
+ // eslint-disable-next-line no-console
99
+ console.warn(
100
+ '[@react-native-firebase/auth] REVERSED_CLIENT_ID field not found in GoogleServices-Info.plist. Google Sign-In requires this is - if you need Google Sign-In, enable it and re-download your plist file',
101
+ );
102
+ }
89
103
 
90
104
  return config;
91
105
  }
@@ -1 +1 @@
1
- {"root":["./src/index.ts","./src/pluginConfig.ts","./src/ios/index.ts","./src/ios/openUrlFix.ts","./src/ios/urlTypes.ts"],"version":"5.7.3"}
1
+ {"root":["./src/index.ts","./src/pluginConfig.ts","./src/ios/index.ts","./src/ios/openUrlFix.ts","./src/ios/urlTypes.ts"],"version":"5.8.3"}