firebase / firebase/firebase-js-sdk

Firebase auth emulator recaptcha verifier is only triggered once

Open
#4,126 0 comments 0 reactions 0 assignees View on GitHub
api: auth needs-attention question testing-sdk
Dominant language
TypeScript
Stars
5.1k
Forks
1k
Avg merge
2d 21h
Merged PRs (30d)
37

Description

### [REQUIRED] Describe your environment

* Operating System version: macOs Catalina 10.15.6
* Browser version: Chrome Version 86.0.4240.198 (Official Build) (x86_64)
* Firebase SDK version: 8.1.1
* Firebase Product: auth emulator

### [REQUIRED] Describe the problem
Using firebase auth emulator google recaptcha is triggered only once, the second time nothing happens.
If I turn off the local auth emulator it works as expected.

#### Steps to reproduce:

1.Start firebase auth locally
2.Use it in front end:
`firebase.auth().useEmulator('http://localhost:9099/')`
3. Add recaptcha div:
`

`
4. Render re-captcha:
```
window.recaptchaVerifier = new firebase.auth.RecaptchaVerifier('recaptcha', {
size: 'invisible',
badge: 'inline',
callback: () => {
try {
console.log('I will work only once with emulator, without I will run on every verify() execution')
window.recaptchaVerifier.reset()
} catch (e) {
window.recaptchaVerifier.reset()
console.error('Error in recaptcha callback: ', e.message)
}
},
'error-callback': e => {
console.log('Error callback:', e)
window.recaptchaVerifier.reset()
},
'expired-callback': e => {
console.log('Error expire-callback:', e)
window.recaptchaVerifier.reset()
}
})
await window.recaptchaVerifier.render()
```
5. Trigger this function multiple times:
`window.recaptchaVerifier.verify()`
It will console.log only once with auth emulator , if you comment out step 2 :
` // firebase.auth().useEmulator('http://localhost:9099/')`
It will be triggered correctly multiple times.

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.