Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The "Send Code" button for MFA is never enabled even after entering valid phone number and successful recaptcha #711

Open
faridghar opened this issue Jun 4, 2023 · 1 comment

Comments

@faridghar
Copy link

I'm trying to run the the MFA authentication example on Firebase Hosting. After signing up a user and verifying the email, when I click the "Enroll" button and enter a valid phone number (+971XXXXXXX) and successfully do the recaptcha (I see a green check mark), the "Send Code" button remains disabled. Upon debugging, it seems the issue is is in line 396 of the "mfa-password.js" file because the grecpatcha variable is undefined whereas the recaptchaWidgetId variable is not null. So the if condition fails and the function returns false. If I modify the isCaptchaOK() function to simply return true (hardcoded), then the button becomes enabled and I'm able to successfully receive a verification code on my phone.

I'm not a recpatch expert but it doesn't seem like there's anywhere in the mfa-password.js where the grecpatch variable is being initialized. Am I missing something or is this variable somehow initialized by the recaptcha library? If so, why isn't it working in my case?

@faridghar
Copy link
Author

Based on this, I used window.grecaptcha in the isCaptchaOK() function and it works now. Not sure if I did something wrong or if this code needs to be changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant