firebase / firebase/firebase-tools

Calling verifyPhoneNumber more than once hangs

Open
#6,663 4 comments 0 reactions 0 assignees View on GitHub
emulators: auth type: bug
Dominant language
TypeScript
Stars
4.5k
Forks
1.3k
Avg merge
1d 12h
Merged PRs (30d)
84

Description

### Operating System

macOS

### Browser Version

Safari 16.5.2

### Firebase SDK Version

10.4.0

### Firebase SDK Product:

Auth

### Describe your project's tooling

index.html with source tag.

### Describe the problem

Calling [verifyPhoneNumber](https://firebase.google.com/docs/reference/js/auth.phoneauthprovider.md#phoneauthproviderverifyphonenumber) twice makes the app hang.

### Steps and code to reproduce issue

```
if (error.code == 'auth/multi-factor-auth-required') {
resolver = getMultiFactorResolver(auth, error);
const phoneAuthProvider = new PhoneAuthProvider(auth);
var recaptcha = new RecaptchaVerifier(auth, 'recaptcha-container');
phoneAuthProvider.verifyPhoneNumber("+16505553434", recaptcha)
.then(function (verificationId) {
var verificationCode = prompt("verification code");
const cred = PhoneAuthProvider.credential(verificationId, verificationCode);
const multiFactorAssertion = PhoneMultiFactorGenerator.assertion(cred);
resolver.resolveSignIn(multiFactorAssertion)
.then(function (userCredential) {
console.log(userCredential);
phoneAuthProvider.verifyPhoneNumber("+16505553434", recaptcha)//hangs. then doesn't run, catch doesn't run.
.then(verificationId => {
var verificationCode = prompt("verification code");
const cred = PhoneAuthProvider.credential(verificationId, verificationCode);
const multiFactorAssertion = PhoneMultiFactorGenerator.assertion(cred);
resolver.resolveSignIn(multiFactorAssertion).then(userCredential => {
console.log(userCredential);
})
}).catch(error => console.error(error));

});
});
}
```

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.