Skip to content

refactor(auth)!: migrate to TypeScript and bring auth closer in alignment with firebase-js-sdk API#8991

Draft
russellwheatley wants to merge 44 commits intomainfrom
auth-typescript
Draft

refactor(auth)!: migrate to TypeScript and bring auth closer in alignment with firebase-js-sdk API#8991
russellwheatley wants to merge 44 commits intomainfrom
auth-typescript

Conversation

@russellwheatley
Copy link
Copy Markdown
Member

@russellwheatley russellwheatley commented Apr 21, 2026

Updated to main and re-pushed to verify things still work since we're not using a merge queue here

release notes will come from the commit, so here's the draft of the commit message pulled from the description:


BREAKING CHANGE: auth types now match firebase-js-sdk as closely as possible

Please see https://rnfirebase.io/migrating-to-v25 for help migrating if needed.

react-native-firebase has a goal to be a drop-in replacement for firebase-js-sdk, with native extensions and performance. It has always worked that way at the javascript level but the typescript types have been divergent.

We are fixing that as we refactor to typescript. Please bear with us as we get closer to our goal of react-native-firebase matching firebase-js-sdk both in functionality where possible, but also in exact typescript typing.

Specifics for Auth:

  • aligned the modular TypeScript surface with the firebase-js-sdk, so modular types like Auth, User, UserCredential, ActionCodeInfo, MultiFactorResolver, and MultiFactorUser no longer use the deprecated FirebaseAuthTypes namespace types in their public signatures; TypeScript consumers should import the modular types directly from @react-native-firebase/auth.
  • removed the modular initializeRecaptchaConfig export from @react-native-firebase/auth; RN Firebase uses native SDK phone-auth verification rather than the browser reCAPTCHA bootstrap flow.
  • changed modular sendSignInLinkToEmail(auth, email, actionCodeSettings) so actionCodeSettings is required, matching the firebase-js-sdk modular signature.
  • changed modular signInWithPhoneNumber(auth, phoneNumber, appVerifier?) so the old RNFB forceResend fourth argument is no longer part of the modular signature; use the RNFB-specific verifyPhoneNumber(...) helper for the native listener / force-resend flow.
  • changed modular redirect helper typings for native auth provider flows: signInWithRedirect(...) and linkWithRedirect(...) now return Promise<UserCredential> because RN Firebase native provider flows resolve immediately with credentials instead of following the browser redirect contract.
  • kept the namespaced FirebaseAuthTypes API for backwards compatibility, but marked it deprecated and separated it from the modular public types; consumers should prefer direct exported modular types going forward.
  • adjusted namespaced type details during the split, including FirebaseAuthTypes.UserInfo nullable profile fields and firebase.auth().config now typed as Record<string, never> rather than Map<any, any>.

Related issues

Release Summary

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
    • Yes
  • My change supports the following platforms;
    • Android
    • iOS
    • Other (macOS, web)
  • My change includes tests;
    • e2e tests added or updated in packages/\*\*/e2e
    • jest tests added or updated in packages/\*\*/__tests__
  • I have updated TypeScript types that are affected by my change.
  • This is a breaking change;
    • Yes
    • No

Test Plan


Think react-native-firebase is great? Please consider supporting the project with any of the below:

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 21, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
react-native-firebase Error Error Apr 27, 2026 2:33pm

Request Review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the modular API for the Auth package and refactors the namespaced API with improved TypeScript support. Key updates include the integration of react-native-builder-bob for builds, a fix for a logic error in TOTP secret handling, and the addition of type comparison configurations. Feedback was provided to improve the clarity of an error message in the password validation logic and to refine the emulator URL parsing to handle missing ports more explicitly.

Comment thread packages/auth/lib/modular.ts Outdated
Comment thread packages/auth/lib/namespaced.ts Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant