alex_empallo
11/13/2024, 10:26 PMResetPasswordPage.tsx example: https://github.com/medplum/medplum/blob/main/packages/app/src/ResetPasswordPage.tsx
Here’s the setup and problem:
- On my GCP project, I've created a reCAPTCHA token. I have "whitelisted" my app's URL, localhost, etc. for this token.
- On the [Medplum Admin Sites](https://app.medplum.com/admin/details) page, I’ve provided the "Recaptcha Site Key" and "Recaptcha Secret Key" that correspond to this token.
- When I log the recaptchaSiteKey to the browser console, I can see that it is correct.
- When I attempt to reset my password via the Medplum frontend, I receive a "Recaptcha failed" error (please see the full error logged to browser console at the end of this message*).
- However, when I log the recaptchaToken to my browser console and use it in a curl request on my VM's CLI, **the verification succeeds**: curl -X POST -d "secret=RECAPTCHA_SECRET_KEY&response=RECAPTCHA_TOKEN" https://www.google.com/recaptcha/api/siteverify
Given that the curl request works, it seems like this issue might be occurring at the backend level. Could someone please help clarify what might be going wrong here?
*Full recaptcha error logged to browser console:
{
"resourceType": "OperationOutcome",
"issue": [
{
"severity": "error",
"code": "invalid",
"details": {
"text": "Recaptcha failed"
}
}
],
"extension": [
{
"url": "https://medplum.com/fhir/StructureDefinition/tracing",
"extension": [
{
"url": "requestId",
"valueId": "[redacted]"
},
{
"url": "traceId",
"valueId": "[redacted]"
}
]
}
]
}alex_empallo
11/14/2024, 4:29 PMPOST statement on [line 42 of ResetPasswordPage.tsx](https://github.com/medplum/medplum/blob/main/packages/app/src/ResetPasswordPage.tsx#L42) should include recaptchaSiteKey in the body arg.
In other words:
.post('auth/resetpassword', { ...formData, recaptchaToken, recaptchaSiteKey })