How to Use reCAPTCHA Enterprise with Firebase Phone Authentication
Environment
- Firebase JavaScript SDK: version 11.6.0
Steps I’ve followed:
- Created reCAPTCHA Enterprise key in the GCP console:
- Registered reCAPTCHA Enterprise in Firebase Console App Check:
- Under the “Apps” tab in Firebase App Check settings.
- Applied Authentication in Firebase App Check:
- Under the “API” tab in Firebase App Check settings.
- Configured via Admin SDK (
updateProjectConfigmethod):
const projectConfig = await admin.auth().projectConfigManager().updateProjectConfig({
recaptchaConfig: {
phoneEnforcementState: 'ENFORCE',
useSmsTollFraudProtection: true,
useSmsBotScore: true,
}
});
- Executed
signInWithPhoneNumberon the frontend (without the third argument):
Request URL:
<URL Removed by Staff>
Response:
{
"error": {
"code": 500,
"message": "Internal error encountered.",
"status": "INTERNAL"
}
}
When switching phoneEnforcementState to OFF
Admin SDK configuration:
const projectConfig = await admin.auth().projectConfigManager().updateProjectConfig({
recaptchaConfig: {
phoneEnforcementState: 'OFF',
useSmsTollFraudProtection: false,
useSmsBotScore: false,
}
});
Response becomes:
{
"recaptchaEnforcementState": [
{
"provider": "EMAIL_PASSWORD_PROVIDER",
"enforcementState": "ENFORCEMENT_STATE_UNSPECIFIED"
},
{
"provider": "PHONE_PROVIDER",
"enforcementState": "OFF"
}
],
"useSmsBotScore": false,
"useSmsTollFraudProtection": false
}
Question
I want to enable reCAPTCHA Enterprise for Firebase Phone Authentication, but I keep receiving a 500 Internal error. Is there anything I’m missing or doing incorrectly?
