Bring your own reCAPTCHA keys

You can use your own reCAPTCHA key with Identity Platform integration with the reCAPTCHA Enterprise API.

When the Identity Platform integration with the reCAPTCHA Enterprise API is enabled, Identity Platform provisions reCAPTCHA keys on your behalf by default. However, you can choose to bring your own reCAPTCHA key to use with reCAPTCHA. Uploading your own reCAPTCHA key disables the provisioning by Identity Platform.

Enable the ability to bring your own key

To enable this capability and upload your reCAPTCHA key, call the endpoint with the following curl command:

curl -i -X PATCH -H 'Content-Type: application/json' -H
"x-goog-user-project: PROJECT_ID" -H 'Authorization: Bearer OAUTH_TOKEN' -d
'
{
  "recaptchaConfig": {
    "recaptchaKeys": [{"key": "projects/PROJECT_NUMBER/keys/KEY_VALUE",
    "type": "PLATFORM_TYPE"}],
  },
}'
https://identitytoolkit.googleapis.com/v2/projects/PROJECT_ID/config?updateMask=recaptchaConfig.recaptchaKeys

Replace the following:

  • PROJECT_ID: the project ID
  • OAUTH_TOKEN: the credential used for administrator requests
  • PROJECT_NUMBER: the project number
  • KEY_VALUE: the string that represents the reCAPTCHA key you want to upload
  • PLATFORM_TYPE: the platform of the application using the reCAPTCHA key. Valid values are WEB, ANDROID, and IOS.

Disable the ability to bring your own key

To continue provisioning reCAPTCHA keys through Identity Platform, call the endpoint with curl and pass an empty list for recaptchaConfig.recaptchaKeys. For example:

curl -i -X PATCH -H 'Content-Type: application/json' -H "x-goog-user-project:
PROJECT_ID" -H 'Authorization: Bearer OAUTH_TOKEN' -d '
{
  "recaptchaConfig": {
    "recaptchaKeys": [],
  },
}'
https://identitytoolkit.googleapis.com/v2/projects/PROJECT_ID/config?updateMask=recaptchaConfig.recaptchaKeys

Replace the following:

  • PROJECT_ID: the project ID
  • OAUTH_TOKEN: the credential used for administrator requests