next-hcaptcha icon indicating copy to clipboard operation
next-hcaptcha copied to clipboard

`not-using-dummy-secret` error returned for valid token when custom environment variable configured

Open WolfyUK opened this issue 2 years ago • 0 comments

When using a custom next-hcaptcha.config.js and an environment variable containing the secret key that is not named HCAPTCHA_SECRET, all responses from https://hcaptcha.com/siteverify return the error code not-using-dummy-secret.

e.g.

/** @type import("next-hcaptcha").NextHCaptchaOptions */
const config = {
    envVarNames: { secret: "HCAPTCHA_SECRET_KEY" },
    errorDisplayMode: "code"
};

export default config;

With the response payload from the withHCaptcha HOC when using the 'success' test key and secret:

{ "success": false, "error-codes": ["not-using-dummy-secret"] }

The cause of this seems to be because the environment variable is not correctly set in the POST payload. A PR will be issued for this shortly.

WolfyUK avatar Feb 08 '23 14:02 WolfyUK