firebase / firebase/firebase-js-sdk

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

Open
#4,683 15 comments 1 reaction 0 assignees View on GitHub
api: auth bug internal-bug-filed
Dominant language
TypeScript
Stars
5.1k
Forks
1k
Avg merge
2d 21h
Merged PRs (30d)
37

Description

### 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 user`myid2@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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.