Skip to content

reauthenticateWithPopup() method is adding a new user entry in the Firebase Authentication. #4683

Open
@arunraj6

Description

@arunraj6

Describe your environment

  • Operating System version: macOS Big Sur 11.2.3
  • Browser version: 89.0.4389.90
  • Firebase SDK version: 8.2.10
  • Firebase Product: auth

Describe the problem

When we reauthenticate a user using Google auth provider, a user is being added to the Firebase Authentication if we use another account to sign in instead of the previously signed-in user.

Steps to reproduce:

  1. Sign in a user with Google auth provider by using signInWithPopup() method (example user: myid1@gmail.com).
  2. Try to delete this user from a web application.
  3. Need to reauthenticate the user myid1@gmail.com by using reauthenticateWithPopup() method.
  4. In the sign-in popup try to give some different google account (example: myid2@gmail.com).
  5. A new user entry will be added in the Firebase Authentication for the usermyid2@gmail.com.

Relevant Code:

import * as firebase from 'firebase/app';
            
        const user = firebase.default.auth().currentUser;   
        user.reauthenticateWithPopup(new firebase.default.auth.GoogleAuthProvider())
            .then(() => {
                // Success
            }).catch((error) => {
                //Error: The supplied credentials do not correspond to the previously signed in user.
            });

The proper error message (The supplied credentials do not correspond to the previously signed in user.) is coming in the catch block and also a new user is created which can be avoided.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions