Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App

Related Articles

How to send email verification link with firebase using ReactJS?

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

In this article we are going to see how to send an email verification link with firebase using React.js. 

For Setup a firebase (Setup a Firebase for your React Project).

Creating React Application And Installing Module.

  • Step 1: Create a React myapp using the following command.

    npx create-react-app myapp
  • Step 2: After creating your project folder i.e. myapp, move to it using the following command.

    cd myapp

Project structure: The project structure will look like this.

Step 3: After creating the ReactJS application, Install the firebase module using the following command.

npm install firebase@8.3.1 --save

Step 4: Go to your firebase dashboard and create a new project and copy your credentials.

const firebaseConfig = {
      apiKey: "your api key",
      authDomain: "your credentials",
      projectId: "your credentials",
      storageBucket: "your credentials",
      messagingSenderId: "your credentials",
      appId: "your credentials"

Step 5: Now Enable the sign in with email and password from your sign-in method.

Example: Initialize the firebase into your project by creating firebase.js file with the following code.


import firebase from 'firebase';
const firebaseConfig = {
    // Your credentials
var auth = firebase.auth();
export default auth;

Now write some code into your App.js file. 


import auth from './firebase';
import './App.css';
import {useState} from 'react';
function App() {
  const [email , setemail] = useState('');
  const [password , setpassword] = useState('');
  const signup = ()=>{
      auth.createUserWithEmailAndPassword(email , password)
          // send verification mail.
        alert("Email sent");
  return (
    <div className="App">
      <input type="email" placeholder="Email" 
      <input type="password" placeholder="password" 
      <button onClick={signup}>Sign-up</button>
export default App;

Output : 

Here, When you click on sign-up button the verification email is send to the provided email address.

Here is the verification mail. 

My Personal Notes arrow_drop_up
Last Updated : 12 Apr, 2021
Like Article
Save Article
Similar Reads
Related Tutorials