I use Umbraco Forms with the built in Recaptcha v3. when i put the keys in UmbracoForms.config it works fine.
I tried to put my Keys in the Appsettings.config. I found, where the Sitekey is called, but not the Privatekey.
In \Views\Partials\Forms\Themes\default\FieldTypes\FieldType.Recaptcha3.cshtml you can get the key from the Appsettings via ConfigurationManager.AppSettings["RecaptchaV3SiteKey"];
I want to do the same with the private Key, where is the forms getting the key in UmbracoForms.config?
When I try to fill out a form with the keys in Appsettings, I get the error
The Google reCAPTCHA failed to validate your submission
Yes, you misunderstood the question
The Recaptcha is working with the Keys in UmbracoForms.config. but I want them in appsettings.config to have different Keys in production and development. It works with the sitekey, but not with the privatekey
I don't think that is possible at the moment, but on the short term you could set up a config transform during your build to replace the keys in the UmbracoForms.config file.
However, to set some expectations though: since this is something that's never been requested before in all the time this setup has existed, plus the fact that there are other ways to do this, I doubt it will be picked up by the Forms team any time soon.
Recaptcha Keys in Appsettings
I use Umbraco Forms with the built in Recaptcha v3. when i put the keys in UmbracoForms.config it works fine.
I tried to put my Keys in the Appsettings.config. I found, where the Sitekey is called, but not the Privatekey.
In
\Views\Partials\Forms\Themes\default\FieldTypes\FieldType.Recaptcha3.cshtml
you can get the key from the Appsettings viaConfigurationManager.AppSettings["RecaptchaV3SiteKey"];
I want to do the same with the private Key, where is the forms getting the key in UmbracoForms.config?
When I try to fill out a form with the keys in Appsettings, I get the error
Not in
UmbracoForms.config
, you put them in your appSettings: https://docs.umbraco.com/umbraco-forms/editor/creating-a-form/fieldtypes/recaptcha3/I'm using Umbraco v8, there you have to put it in UmbracoForms.conig
Ah yes then it's this documentation:
https://our.umbraco.com/documentation/Add-ons/umbracoforms/editor/creating-a-form/fieldtypes/Recaptcha3/#for-version-8x-and-below
I think I misunderstood the question, are you saying you can't get the private key from the configurationmanager?
Yes, you misunderstood the question
The Recaptcha is working with the Keys in UmbracoForms.config. but I want them in appsettings.config to have different Keys in production and development. It works with the sitekey, but not with the privatekey
I don't think that is possible at the moment, but on the short term you could set up a config transform during your build to replace the keys in the UmbracoForms.config file.
Alternatively, you could use this package https://our.umbraco.com/packages/website-utilities/recaptcha-v3-for-umbraco-forms/ or your own implementation of a fieldtype (the source for this package is available for inspiration).
You could creating an issue for this feature request here: https://github.com/umbraco/Umbraco.Forms.Issues/issues/new/choose
However, to set some expectations though: since this is something that's never been requested before in all the time this setup has existed, plus the fact that there are other ways to do this, I doubt it will be picked up by the Forms team any time soon.
is working on a reply...