Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

311
Views
React with Firebase signInWithPhoneNumber Nothing is Happening on Button Click

I'm trying to build a simple app that allows sign in using phone number, but it appears to do absolutely nothing when I click the button that calls "setupCaptcha".

The line: import firebase from '../firebase' (line 5) does absolutely nothing (it is not being referenced anywhere in the code), but when I comment it out it gives me this error: Firebase: No Firebase App '[DEFAULT]' has been created - call Firebase App.initializeApp() (app/no-app). when I uncomment it, the button click does absolutely nothing.

import React from 'react'
import { useHistory } from 'react-router-dom'
import { MainButton } from '../components/MainButton'
import { MainInput } from '../components/MainInput'
import firebase from '../firebase'


// import { getAuth, RecaptchaVerifier, signinWithPhoneNumber } from "firebase/auth";
import { getAuth, RecaptchaVerifier, signInWithPhoneNumber } from "firebase/auth";



export default function EnterPhoneNumber() {
    const history = useHistory();

    // const phoneNumber = getPhoneNumberFromUserInput();
    

    function setupCaptcha() {
        const auth = getAuth();
        window.recaptchaVerifier = new RecaptchaVerifier('sign-in-button', {
            'size': 'invisible',
            'callback': (response) => {
                // reCAPTCHA solved, allow signInWithPhoneNumber.
                // onSignInSubmit();
                onSignInSubmit()
            }
        }, auth);
    }

    function onSignInSubmit() {
        const auth = getAuth();
        const appVerifier = window.recaptchaVerifier;
        signInWithPhoneNumber(auth, "+447xxxxxxxxx", appVerifier)
            .then((confirmationResult) => {
                // SMS sent. Prompt user to type the code from the message, then sign the
                // user in with confirmationResult.confirm(code).
                window.confirmationResult = confirmationResult;
                // ...
            }).catch((error) => {
                // Error; SMS not sent
                // ...
            });
    }

This is my firebase.js file:

import firebase from 'firebase/compat/app'
// import 'firebase/compat/auth'

const app = firebase.initializeApp({
    apiKey: "xxxxxxx",
    authDomain: "xxxxxx.firebaseapp.com",
    projectId: "xxxxxx",
    storageBucket: "xxxxxxxx.appspot.com",
    messagingSenderId: "xxxxxxxx",
    appId: "xxxxxxxxxx"
})

// export const auth = app.auth(); 

export default firebase;
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!