RNFirebase email verification

0

I'm trying to send email to users those who signup from my app but I'm getting auth/internal-error in response. Can someone help me to fix this issue???

          var currentUser = firebase.auth().currentUser;
          var actionCodeSettings = {
            url: WEBSITE,
            iOS: {
              bundleId: getBundleIdentifier()
            },
            android: {
              packageName: getBundleIdentifier(),
              installApp: false,
              minimumVersion: '1'
            },
            handleCodeInApp: false,
            dynamicLinkDomain: getDynamicLink()
          };
          currentUser.sendEmailVerification(actionCodeSettings).then(function () {
            console.log('email sent');
          }, function (error) {
            console.log('email not sent ' + error);
          });

This is the code which I'm using to send email to signup or logged in user and below is my logged console error

Error: An internal error has occurred, please try again.
    at createErrorFromErrorData (NativeModules.js:155)
    at NativeModules.js:104
    at MessageQueue.__invokeCallback (MessageQueue.js:414)
    at MessageQueue.js:127
    at MessageQueue.__guard (MessageQueue.js:314)
    at MessageQueue.invokeCallbackAndReturnFlushedQueue (MessageQueue.js:126)
    at debuggerWorker.js:80

Detail error description:

code: "auth/internal-error"
domain: "FIRAuthErrorDomain"
framesToPop: 1
nativeStackIOS: (15) ["0   [PROJECT_ID]                    0x000000010570380c RCTJSErrorFromCodeMessageAndNSError + 156", "1   [PROJECT_ID]                    0x00000001… processMethodSignature]_block_invoke_2.129 + 176", "2   [PROJECT_ID]                    0x00000001…baseAuth promiseRejectAuthException:error:] + 292", "3   [PROJECT_ID]                     0x00000001…odeSettings:resolver:rejecter:]_block_invoke + 92", "4   [PROJECT_ID]                    0x00000001…904 __callInMainThreadWithError_block_invoke + 56", "5   libdispatch.dylib                   0x00000001…658 721C34EF-4ABD-395F-8285-FECAA2457BA3 + 370264", "6   libdispatch.dylib                   0x00000001…1cc 721C34EF-4ABD-395F-8285-FECAA2457BA3 + 373196", "7   libdispatch.dylib                   0x00000001…3290 721C34EF-4ABD-395F-8285-FECAA2457BA3 + 53904", "8   CoreFoundation                      0x00000001…c74 6E8ED431-E507-3897-BF3A-AFD3D4C2C49F + 691316", "9   CoreFoundation                      0x00000001…c68 6E8ED431-E507-3897-BF3A-AFD3D4C2C49F + 670824", "10  CoreFoundation                      0x00000001aac6b16c CFRunLoopRunSpecific + 464", "11  GraphicsServices                    0x00000001b4aa3328 GSEventRunModal + 104", "12  UIKitCore                           0x00000001aecd5d0c UIApplicationMain + 1936", "13  [PROJECT_ID]                    0x0000000104a90e5c main + 124", "14  libdyld.dylib                       0x00000001…f6424 8F3A474D-45CC-3991-829F-77B3B151BA86 + 5156"]
userInfo: {FIRAuthErrorUserInfoNameKey: "ERROR_INTERNAL_ERROR", NSLocalizedDescription: "An internal error has occurred, print and inspect the error details for more information.", NSUnderlyingError: {…}}
message: "An internal error has occurred, please try again."
stack: "Error: An internal error has occurred, please try again.↵    at createErrorFromErrorData (blob:http://localhost:8081/c7064c8e-a43f-4040-a949-22732e1989f3:2126:17)↵    at blob:http://localhost:8081/c7064c8e-a43f-4040-a949-22732e1989f3:2078:27↵    at MessageQueue.__invokeCallback (blob:http://localhost:8081/c7064c8e-a43f-4040-a949-22732e1989f3:2645:18)↵    at blob:http://localhost:8081/c7064c8e-a43f-4040-a949-22732e1989f3:2376:18↵    at MessageQueue.__guard (blob:http://localhost:8081/c7064c8e-a43f-4040-a949-22732e1989f3:2549:13)↵    at MessageQueue.invokeCallbackAndReturnFlushedQueue (blob:http://localhost:8081/c7064c8e-a43f-4040-a949-22732e1989f3:2375:14)↵    at http://localhost:8081/debugger-ui/debuggerWorker.js:80:58"
__proto__: Object
firebase
react-native
firebase-authentication
react-native-firebase
asked on Stack Overflow Sep 26, 2019 by James Matthew

1 Answer

0

Consider this:

  • You can only send email verification to users whose created using Email&Password method createUserWithEmailAndPassword
  • On Successful Signing, Firebase will return a promise of the auth object.
  • The old onAuth method has been changed to onAuthStateChanged.

Check email is verified:

firebase.auth().onAuthStateChanged(function(user) { 
   if (user.emailVerified) {
       user.sendEmailVerification();
   }
   else {
      console.log('Not verified');
   }
});
answered on Stack Overflow Sep 26, 2019 by Krishna Vyas

User contributions licensed under CC BY-SA 3.0