## Issue When using the **modular API** from @react-native-firebase/auth, calling `getIdToken(currentUser, true)` occasionally returns a valid ID token associated with a **new Firebase UID**. This behavior does not occur when using the older **namespaced API** `(firebase.auth().currentUser.getIdToken(true))`, which correctly returns a fresh token for the **existing user**. This is **critical** for apps that sync user data with a backend based on UID. **Code sample** **_With modular API (causes unexpected new UID):_** ``` public async refreshToken() { const auth = getAuth() if (auth.currentUser) { const idToken = await getIdToken(auth.currentUser, true) // returns token with new UID return idToken } } ``` **_With namespaced API (works as expected):_** ``` public async refreshToken() { const auth = getAuth() if (auth.currentUser) { const idToken = await auth.currentUser.getIdToken(true) // returns token with existing UID return idToken } } ``` --- ## Project Files ### Javascript Click To Expand #### `package.json`: ```json { "dependencies": { "@react-native-firebase/app": "22.4.0", "@react-native-firebase/auth": "22.4.0", "react-native": "0.80.1" } } ``` #### `firebase.json` for react-native-firebase v6: ```json # N/A ``` ### iOS Click To Expand #### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like: ```ruby ... config = use_native_modules! use_frameworks! :linkage => :static $RNFirebaseAsStaticFramework = true use_react_native!( :path => config[:reactNativePath], # An absolute path to your application root. :app_path => "#{Pod::Config.instance.installation_root}/.." ) ... ``` #### `AppDelegate.m`: ```objc import Firebase ... func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication .LaunchOptionsKey: Any]? = nil ) -> Bool { FirebaseApp.configure() let delegate = ReactNativeDelegate() ... ``` --- ### Android Click To Expand #### Have you converted to AndroidX? - [ ] my application is an AndroidX application? - [ ] I am using `android/gradle.settings` `jetifier=true` for Android compatibility? - [ ] I am using the NPM package `jetifier` for react-native compatibility? #### `android/build.gradle`: ```groovy buildscript { dependencies { ... classpath 'com.google.gms:google-services:4.4.3' } } ``` #### `android/app/build.gradle`: ```groovy apply plugin: 'com.google.gms.google-services' ``` #### `android/settings.gradle`: ```groovy // N/A ``` #### `MainApplication.java`: ```java // N/A ``` #### `AndroidManifest.xml`: ```xml ``` --- ## Environment Click To Expand **`react-native info` output:** ``` System: OS: macOS 14.5 CPU: (8) arm64 Apple M3 Memory: 89.20 MB / 16.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 20.9.0 path: /var/folders/nr/kt8fqryx0ndch1jk3_wdswqc0000gp/T/yarn--1754037765131-0.4040609396968249/node Yarn: version: 1.22.22 path: /var/folders/nr/kt8fqryx0ndch1jk3_wdswqc0000gp/T/yarn--1754037765131-0.4040609396968249/yarn npm: version: 10.1.0 path: /usr/local/bin/npm Watchman: version: 2025.06.30.00 path: /opt/homebrew/bin/watchman Managers: CocoaPods: version: 1.16.2 path: /Users/anastasiianahaiska/.rbenv/shims/pod SDKs: iOS SDK: Platforms: - DriverKit 24.2 - iOS 18.2 - macOS 15.2 - tvOS 18.2 - visionOS 2.2 - watchOS 11.2 Android SDK: Not Found IDEs: Android Studio: 2024.3 AI-243.24978.46.2431.13208083 Xcode: version: 16.2/16C5032a path: /usr/bin/xcodebuild Languages: Java: version: 17.0.14 path: /usr/bin/javac Ruby: version: 3.4.2 path: /Users/anastasiianahaiska/.rbenv/shims/ruby npmPackages: "@react-native-community/cli": installed: 19.0.0 wanted: 19.0.0 react: installed: 19.1.0 wanted: 19.1.0 react-native: installed: 0.80.1 wanted: 0.80.1 react-native-macos: Not Found npmGlobalPackages: "*react-native*": Not Found Android: hermesEnabled: true newArchEnabled: true iOS: hermesEnabled: true newArchEnabled: true ``` - **Platform that you're experiencing the issue on**: - [ ] iOS - [ ] Android - [ ] **iOS** but have not tested behavior on Android - [ ] **Android** but have not tested behavior on iOS - [x] Both - **`@react-native-firebase/auth` version you're using that has this issue:** - `22.4.0` - **`Firebase` module(s) you're using that has the issue:** - `e.g. Instance ID` - **Are you using `TypeScript`?** - `Y` `5.8.3` --- - π Check out [`React Native Firebase`](https://twitter.com/rnfirebase) and [`Invertase`](https://twitter.com/invertaseio) on Twitter for updates on the library.