ReCaptcha V3 not working - app settings not read
When ReCaptcha V3 control is added to a form, and the SiteKey and PrivateKey are added to the app settings, the control still believes the app setting has not been added.
Reproduction
- Add Recaptcha V3 with score control to a Umbraco Form
- Generate SiteKey and PrivateKey with Google for the given domain
- Add app settings: "Umbraco": { "CMS": { "Forms": { "FieldTypes": { "Recaptcha3": { "SiteKey": "YOUR_SITE_KEY_HERE", "PrivateKey": "YOUR_PRIVATE_KEY_HERE" } } }
- Notice the form still generates the error message: ERROR: reCAPTCHA v3 is missing the Site Key. Please update the configuration to include a value at: Umbraco:Forms:FieldTypes:Recaptcha3:SiteKey
Specifics
Chrome Version 127.0.6533.72 Umbraco Version 14.1.0 Umbraco Forms Version 14.0.2
Expected result
Recaptcha should be generated.
Actual result
Error received: ERROR: reCAPTCHA v3 is missing the Site Key. Please update the configuration to include a value at: Umbraco:Forms:FieldTypes:Recaptcha3:SiteKey
I think the problem here is that you have your "Forms" configuration element as a child of the "CMS" one, which isn't correct, it should be a sibling. So for example:
"Umbraco": {
"CMS": {
},
"Forms": {
"FieldTypes": {
"Recaptcha3": {
"SiteKey": "YOUR_SITE_KEY_HERE",
"PrivateKey": "YOUR_PRIVATE_KEY_HERE"
}
}
}
}
Hi Andy - that was my mistake when writing the ticket - the issue still stands - my forms item in app settings is indeed a sibling of CMS as it should be.
Hmm, I'm not seeing the issue I'm afraid on my setup, Please could you just confirm for me that the configuration is in place, by adding this code into one of the views on your website?
@inject Microsoft.Extensions.Configuration.IConfiguration Configuration
<div>Value: @Configuration["Umbraco:Forms:FieldTypes:Recaptcha3:SiteKey"]</div>
I get no value from the configuration but can confirm the configuration structure is correct:
"Umbraco": { "CMS": { "ModelsBuilder": { "ModelsMode": "REDACTED" }, "Forms": { "FieldTypes": { "Recaptcha3": { "SiteKey": "REDACTED", "PrivateKey": "REDACTED" } } }, "Global": { "Id": "REDACTED", "UseHttps": REDACTED, "NoNodesViewPath": "REDACTED", "SanitizeTinyMce": REDACTED, "Smtp": { "Host": "REDACTED", "Port": REDACTED, "Username": "REDACTED", "Password": "REDACTED", "From": "REDACTED", "SecureSocketOptions": "REDACTED" } }, "Content": { "AllowEditInvariantFromNonDefault": REDACTED, "ContentVersionCleanupPolicy": { "EnableCleanup": REDACTED }, "LoginBackgroundImage": "REDACTED", "LoginLogoImage": "REDACTED" }, "Unattended": { "UpgradeUnattended": REDACTED }, "Security": { "AllowConcurrentLogins": REDACTED } } }
I think you need to double-check your config. It's hard to read as you are pasting it unformatted, but that is still showing Forms as a child of the CMS, not a sibling.
Here it is again having just pasted it into a formatter and removed unnecessary values so you can see what I mean:
{
"Umbraco":{
"CMS":{
"ModelsBuilder":{
},
"Forms":{
"FieldTypes":{
"Recaptcha3":{
"SiteKey":"REDACTED",
"PrivateKey":"REDACTED"
}
}
},
"Global":{
},
"Content":{
},
"Unattended":{
},
"Security":{
}
}
}
}
It should be:
{
"Umbraco":{
"CMS":{
"ModelsBuilder":{
},
"Global":{
},
"Content":{
},
"Unattended":{
},
"Security":{
}
},
"Forms":{
"FieldTypes":{
"Recaptcha3":{
"SiteKey":"REDACTED",
"PrivateKey":"REDACTED"
}
}
}
}
}
Will close this now since there was no further discussion.