new firebase.auth.RecaptchaVerifier does not work
See original GitHub issueVersion
@nuxtjs/firebase: 6.1.1 firebase: 7.21.1 nuxt: 2.14.5
Trying to use the phone auth and it requires us to use the Firebase recaptcha, as per the official docs, we are to use the below syntax to initialise the Recaptcha Verifier.
window.recaptchaVerifier = new firebase.auth.RecaptchaVerifier('sign-in-button', {
'size': 'invisible',
'callback': function(response) {
// reCAPTCHA solved, allow signInWithPhoneNumber.
onSignInSubmit();
}
});
Steps to reproduce
- Use the Nuxt Firebase’s Authentication shortcut to initialise the above method
<script>
export default {
mounted() {
window.recaptchaVerifier = new this.$fireAuth.RecaptchaVerifier(
"sign-in-button",
{
size: "invisible",
callback: function (response) {
// reCAPTCHA solved, allow signInWithPhoneNumber.
onSignInSubmit();
},
}
);
},
};
</script>
What is Expected?
Recaptcha is verified
What is actually happening?
Throws a Nuxt error this.$fireAuth.RecaptchaVerifier is not a constructor
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Firebase Phone Auth Recaptcha Verifier not being set to ...
I managed to fix it. I moved the 'new' statement into my context provider: // In context.js recaptchaVerifier = (container, ...
Read more >RecaptchaVerifier | Firebase JavaScript API reference
Reference for RecaptchaVerifier. ... Firebase Auth backend provisions a reCAPTCHA for each project and will configure this upon rendering.
Read more >Notes - Full-Stack Firebase
Firebase Authentication. See the Firebase Authentication docs for web. ... No user is signed in. ... recaptchaVerifier = new firebase.auth.
Read more >FirebaseRecaptcha
Firebase phone authentication is not possible out of the box using the Firebase JS SDK. This because an Application Verifier object (reCAPTCHA) is...
Read more >Firebase Phone Authentication in Ionic 5 Apps
Step 5— Phone auth without ReCaptcha. In this step, developers have two options to make the Phone authentication flow work :-. Do not...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This worked for me !
Thanks to @fayazara, I figured out what I was doing wrong as well. If anyone is using @nuxtjs/firebase module, to use recaptcha you need to do “this.$fireModule.auth.RecaptchaVerifier” and for signinWithPhoneNumber it is “this.$fire.auth.signInWithPhoneNumber”.
$fireModule being the keyword for Recaptcha.