-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Issue
I'm trying to implement email verification in my app, but I am encountering internal errors using the sendEmailVerification
and sendSignInLinkToEmail
methods from the Authentication module.
I added my iOS app to my firebase project with no issues. The createUserWithEmailAndPassword
and signInWithEmailAndPassword
functions work as expected, and sendEmailVerification
works correctly when given no actionCodeSetting
arguments. However, supplying actionCodeSettings
results in an internal server error.
Additionally, sendSignInLinkToEmail
gives me a similar internal error, regardless of whether I include the actionCodeSettings
.
When I added my app as a web app in the firebase console and followed those initialization and authorization steps, everything worked as correctly with actionCodeSettings
.
Code Snippet:
import auth from '@react-native-firebase/auth';
...
const createAndVerify = () => {
const actionCodeSettings = {
url: 'http://localhost:3030/email'
};
auth()
.createUserWithEmailAndPassword(email, password)
.then((res) => {
console.log('created user');
console.log(res);
res.user
.sendEmailVerification(actionCodeSettings) // with no actionCodeSettings, the verification email is sent correctly
.then(() => {
console.log('verification email sent');
})
.catch((e) => {
console.log('unable to send verification email');
console.log(e);
});
})
.catch((err) => {
console.log('unable to create user');
console.log(err);
});
};
I have tried all sorts of combinations of actionCodeSettings
, including setting handleCodeInApp
to true and adding the iOS
property with the correct bundleId
. No matter the configuration, I always get the same error below:
Error:
NativeFirebaseError: [auth/internal-error] An internal error has occurred, please try again.
at User.sendEmailVerification (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:135225:34)
at onAuthStateChanged$ (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:136088:22)
at tryCatch (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:29754:19)
at Generator.invoke [as _invoke] (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:29929:24)
at Generator.prototype.<computed> [as next] (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:29797:23)
at tryCatch (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:29754:19)
at invoke (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:29830:22)
at http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:29860:13
at tryCallTwo (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:6092:7)
Project Files
Javascript
Click To Expand
package.json
:
{
"name": "unmasked",
"version": "2.1.1",
"private": true,
"scripts": {
"android": "react-native run-android --variant=debug",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "echo \"No tests yet\"",
"lint": "eslint ."
},
"dependencies": {
"@react-native-community/async-storage": "^1.6.2",
"@react-native-community/cli-platform-ios": "^2.9.0",
"@react-native-community/masked-view": "^0.1.6",
"@react-native-firebase/app": "^6.3.4",
"@react-native-firebase/auth": "^6.3.4",
"@react-navigation/bottom-tabs": "^5.0.7",
"@react-navigation/native": "^5.0.7",
"@react-navigation/stack": "^5.0.8",
"@react-navigation/tabs": "^0.0.0-alpha.12",
"appcenter": "^2.6.1",
"appcenter-analytics": "^2.6.1",
"appcenter-crashes": "^2.6.1",
"autolinker": "^3.13.0",
"axios": "^0.19.0",
"identicon.js": "^2.3.3",
"libphonenumber-js": "^1.7.44",
"lodash": "^4.17.15",
"moment": "^2.24.0",
"react": "16.9.0",
"react-native": "^0.61.4",
"react-native-autolink": "^3.0.0",
"react-native-code-push": "^6.0.0",
"react-native-config": "^0.12.0",
"react-native-elements": "^1.2.6",
"react-native-gesture-handler": "^1.6.0",
"react-native-icon-badge": "^1.1.3",
"react-native-keyboard-aware-scroll-view": "^0.9.1",
"react-native-mixpanel": "^1.1.10",
"react-native-modal": "^11.4.0",
"react-native-modal-dropdown": "^0.7.0",
"react-native-phone-call": "^1.0.9",
"react-native-reanimated": "^1.7.0",
"react-native-safe-area-context": "^0.7.3",
"react-native-screens": "^2.0.0-beta.10",
"react-native-vector-icons": "^6.6.0",
"react-native-version-number": "^0.3.6",
"react-redux": "^7.1.1",
"redux": "^4.0.4",
"redux-thunk": "^2.3.0",
"socket.io-client": "^2.3.0"
},
"devDependencies": {
"@babel/core": "^7.6.4",
"@babel/runtime": "^7.6.3",
"@react-native-community/eslint-config": "^0.0.5",
"babel-jest": "^24.9.0",
"eslint": "^6.5.1",
"eslint-config-airbnb": "^18.0.1",
"eslint-config-prettier": "^6.4.0",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-react": "^7.18.3",
"jest": "^24.9.0",
"metro-react-native-babel-preset": "^0.56.0",
"prettier": "^1.18.2",
"react-devtools": "3",
"react-test-renderer": "16.9.0"
},
"jest": {
"preset": "react-native"
}
}
firebase.json
for react-native-firebase v6:
# N/A
iOS
Click To Expand
ios/Podfile
:
- I'm not using Pods
- I'm using Pods and my Podfile looks like:
platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
target 'unmasked' do
# Pods for unmasked
pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
pod 'React', :path => '../node_modules/react-native/'
pod 'React-Core', :path => '../node_modules/react-native/'
pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'
pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
target 'unmaskedTests' do
inherit! :search_paths
# Pods for testing
end
use_native_modules!
end
target 'unmasked-tvOS' do
# Pods for unmasked-tvOS
target 'unmasked-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
AppDelegate.m
:
#import "AppDelegate.h"
#import <React/RCTLinkingManager.h>
#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <AppCenterReactNative.h>
#import <AppCenterReactNativeAnalytics.h>
#import <AppCenterReactNativeCrashes.h>
#import <CodePush/CodePush.h>
#import <Firebase.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
moduleName:@"unmasked"
initialProperties:nil];
rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
[FIRApp configure];
[AppCenterReactNative register];
[AppCenterReactNativeAnalytics registerWithInitiallyEnabled:true];
[AppCenterReactNativeCrashes registerWithAutomaticProcessing];
return YES;
}
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
return [CodePush bundleURL];
#endif
}
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
return [RCTLinkingManager application:application openURL:url options:options];
}
- (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity
restorationHandler:(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler
{
return [RCTLinkingManager application:application
continueUserActivity:userActivity
restorationHandler:restorationHandler];
}
@end
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
:
// N/A
android/app/build.gradle
:
// N/A
android/settings.gradle
:
// N/A
MainApplication.java
:
// N/A
AndroidManifest.xml
:
<!-- N/A -->
Environment
Click To Expand
react-native info
output:
yarn run v1.22.0
$ react-native info
info Fetching system and libraries information...
System:
OS: macOS 10.15.1
CPU: (4) x64 Intel(R) Core(TM) i7-5557U CPU @ 3.10GHz
Memory: 320.16 MB / 8.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 13.8.0 - /var/folders/f1/14krtfns4b11b9cm65cc_cjm0000gn/T/yarn--1585426984630-0.33813701803154084/node
Yarn: 1.22.0 - /var/folders/f1/14krtfns4b11b9cm65cc_cjm0000gn/T/yarn--1585426984630-0.33813701803154084/yarn
npm: 6.13.7 - /usr/local/bin/npm
SDKs:
iOS SDK:
Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
Android SDK:
API Levels: 21, 23, 26, 28
Build Tools: 21.1.2, 26.0.1, 28.0.3
System Images: android-26 | Google Play Intel x86 Atom, android-28 | Intel x86 Atom, android-R | Google APIs Intel x86 Atom
IDEs:
Android Studio: 3.6 AI-192.7142.36.36.6241897
Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild
npmPackages:
react: 16.9.0 => 16.9.0
react-native: ^0.61.4 => 0.61.4
npmGlobalPackages:
react-native-cli: 2.0.1
✨ Done in 9.08s.
- 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
- Both
react-native-firebase
version you're using that has this issue:6.3.4
Firebase
module(s) you're using that has the issue:Authentication
- Are you using
TypeScript
?N
Think react-native-firebase
is great? Please consider supporting all of the project maintainers and contributors by donating via our Open Collective where all contributors can submit expenses. [Learn More]
- 👉 Check out
React Native Firebase
andInvertase
on Twitter for updates on the library.