react-native-firebase
react-native-firebase copied to clipboard
verifyPhoneNumberForMultiFactor throw error auth/internal-error
I'm trying to setup 2FA authentication on my react native application but verifyPhoneNumberForMultiFactor
throw auth/internal-error
on iOS.
Here is the code:
async function send2FaVerificationCodeForEnroll(phoneNumber: string): Promise<void> {
try {
if (auth().currentUser) {
const newMultiFactorUser = auth().multiFactor(auth().currentUser!);
const session = await newMultiFactorUser?.getSession();
if (session) {
const phoneOptions = { phoneNumber, session };
const newVerificationId = await auth().verifyPhoneNumberForMultiFactor(phoneOptions);
setVerificationId(newVerificationId);
setMultiFactorUser(newMultiFactorUser);
navigate(Screen.TWO_FACTOR_VERIFICATION, { is2FaEnroll: true });
}
}
} catch (error) {
setAuthError((error as AppError).code);
}
}
Info:
System: OS: macOS 14.6.1 CPU: (10) arm64 Apple M1 Pro Memory: 112.91 MB / 32.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 20.16.0 path: ~/.nvm/versions/node/v20.16.0/bin/node Yarn: version: 3.6.4 path: ~/.yarn/bin/yarn npm: version: 10.8.1 path: ~/.nvm/versions/node/v20.16.0/bin/npm Watchman: version: 2024.09.23.00 path: /opt/homebrew/bin/watchman Managers: CocoaPods: version: 1.15.2 path: /Users/osvaldo/.rvm/gems/ruby-2.7.6/bin/pod SDKs: iOS SDK: Platforms: - DriverKit 23.5 - iOS 17.5 - macOS 14.5 - tvOS 17.5 - visionOS 1.2 - watchOS 10.5 Android SDK: API Levels: - "27" - "28" - "29" - "30" - "31" - "32" - "33" - "34" Build Tools: - 28.0.3 - 29.0.2 - 29.0.3 - 30.0.2 - 30.0.3 - 31.0.0 - 32.0.0 - 32.1.0 - 33.0.0 - 33.0.1 - 34.0.0 System Images: - android-31 | Google APIs ARM 64 v8a - android-32 | Google APIs ARM 64 v8a - android-33 | Google Play ARM 64 v8a - android-34 | Google Play ARM 64 v8a Android NDK: Not Found IDEs: Android Studio: 2023.2 AI-232.10300.40.2321.11567975 Xcode: version: 15.4/15F31d path: /usr/bin/xcodebuild Languages: Java: version: 17.0.12 path: /usr/bin/javac Ruby: version: 2.7.6 path: /Users/osvaldo/.rvm/rubies/ruby-2.7.6/bin/ruby npmPackages: "@react-native-community/cli": Not Found react: installed: 18.3.1 wanted: ^18.3.1 react-native: installed: 0.75.4 wanted: ^0.75.4 react-native-macos: Not Found npmGlobalPackages: "react-native": Not Found Android: hermesEnabled: true newArchEnabled: false iOS: hermesEnabled: true newArchEnabled: false
My package.json:
{ "name": "XXX", "version": "0.0.1", "private": true, "scripts": { "android": "react-native run-android", "ios": "react-native run-ios", "lint": "eslint .", "start": "react-native start", "test": "jest" }, "dependencies": { "@react-native-async-storage/async-storage": "^1.23.1", "@react-native-clipboard/clipboard": "^1.14.2", "@react-native-community/blur": "^4.4.0", "@react-native-firebase/app": "^21.0.0", "@react-native-firebase/auth": "^21.0.0", "@react-native-firebase/dynamic-links": "^21.0.0", "@react-native-masked-view/masked-view": "^0.3.1", "@react-native/metro-config": "^0.75.4", "@react-navigation/native": "^6.1.18", "@react-navigation/native-stack": "^6.11.0", "@react-navigation/stack": "^6.4.1", "@sentry/react-native": "^5.33.1", "@tanstack/react-query": "^5.28.9", "axios": "^1.6.8", "dayjs": "^1.11.10", "deprecated-react-native-prop-types": "^5.0.0", "mustache": "^4.2.0", "qs": "^6.12.0", "react": "^18.3.1", "react-native": "^0.75.4", "react-native-branch": "^6.2.2", "react-native-config": "^1.5.3", "react-native-device-info": "^10.13.1", "react-native-gesture-handler": "^2.20.0", "react-native-linear-gradient": "^2.8.3", "react-native-modal": "^13.0.1", "react-native-reanimated": "^3.15.4", "react-native-render-html": "^6.3.4", "react-native-safe-area-context": "^4.9.0", "react-native-screens": "^3.34.0", "react-native-skeleton-placeholder": "^5.2.4", "react-native-snap-carousel": "latest", "react-native-spinkit": "^1.5.1", "react-native-splash-screen": "^3.3.0", "react-native-sqlite-storage": "^6.0.1", "react-native-svg": "^15.1.0", "react-native-vector-icons": "^10.0.3", "react-native-webview": "^13.8.4", "rn-tooltip": "^3.0.3" }, "devDependencies": { "@babel/core": "^7.25.7", "@babel/plugin-proposal-class-properties": "^7.18.6", "@babel/plugin-proposal-private-methods": "^7.18.6", "@babel/plugin-proposal-private-property-in-object": "^7.21.11", "@babel/preset-env": "^7.25.7", "@babel/runtime": "^7.25.7", "@react-native-community/eslint-config": "^3.2.0", "@tsconfig/react-native": "^2.0.2", "@types/jest": "^29.2.1", "@types/mustache": "^4.2.2", "@types/qs": "^6.9.7", "@types/react": "^18.3.11", "@types/react-native-snap-carousel": "^3.8.11", "@types/react-native-sqlite-storage": "^5.0.2", "@types/react-native-vector-icons": "^6.4.13", "@types/react-test-renderer": "^18.0.0", "babel-jest": "^29.2.1", "babel-plugin-module-resolver": "^5.0.2", "eslint": "^8.19.0", "jest": "^29.2.1", "metro-react-native-babel-preset": "^0.77.0", "prettier": "^2.4.1", "react-native-svg-transformer": "^1.3.0", "react-test-renderer": "18.2.0", "typescript": "^5.6.2" }, "jest": { "preset": "react-native" } }