识别显示相关行为的账号

本文档介绍了如何识别表现出相关行为的帐号。 例如,您可能希望识别由恶意用户创建的所有用户帐号。您可以查找表现出相关行为的帐号、帐号群组和帐号群组成员资格。

当以前合法的账号与具有滥用行为的账号相关时,识别显示相关行为的账号可帮助您发现虚假账号群组和账号接管情况。

此功能仅适用于 reCAPTCHA REST API 和客户端库。

如需检索与指定帐号相关的帐号列表,请使用 relatedaccountgroupmemberships.search 方法。

在使用任何请求数据之前,请先进行以下替换:

  • PROJECT_ID:您的 Google Cloud 项目 ID。
  • ACCOUNT_ID:与您网站的用户帐号的用户帐号唯一关联的标识符。
  • PAGE_SIZE:可选。要包含在响应中的帐号成员资格的数量。 默认值为 50,最大值为 1,000。如果帐号成员数大于页面大小,则响应包含可用于检索下一页结果的分页令牌。
  • NEXT_PAGE_TOKEN:可选。此方法的先前响应中返回的 nextPageToken 值。指定此参数可查询更多账号成员资格。

HTTP 方法和网址:

POST https://recaptchaenterprise.googleapis.com/v1/projects/PROJECT_ID/relatedaccountgroupmemberships:search?page_size=PAGE_SIZE&page_token=NEXT_PAGE_TOKEN

请求 JSON 正文:

{
  "accountId": "ACCOUNT_ID"
}

如需发送请求,请选择以下方式之一:

curl

将请求正文保存在名为 request.json 的文件中,然后执行以下命令:

curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://recaptchaenterprise.googleapis.com/v1/projects/PROJECT_ID/relatedaccountgroupmemberships:search?page_size=PAGE_SIZE&page_token=NEXT_PAGE_TOKEN"

PowerShell

将请求正文保存在名为 request.json 的文件中,然后执行以下命令:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://recaptchaenterprise.googleapis.com/v1/projects/PROJECT_ID/relatedaccountgroupmemberships:search?page_size=PAGE_SIZE&page_token=NEXT_PAGE_TOKEN" | Select-Object -Expand Content

您应该收到类似以下内容的 JSON 响应:

{
  "relatedAccountGroupMemberships": [
    {
      "name": "projects/projectId/relatedaccountgroups/groupId187/memberships/membershipId95",
      "accountId": "4RopXS59"
    },
    {
      "name": "projects/projectId/relatedaccountgroups/groupId91/memberships/membershipId23",
      "accountId": "HVMv1DTb"
    }
  ],

  "nextPageToken": "Q2N_rZgxUXOjNZtK1T1i0Q"
}

代码示例

检索相关账号群组

要检索具有类似行为的账号群组列表,请使用 relatedaccountgroups.list 方法。

在使用任何请求数据之前,请先进行以下替换:

  • PROJECT_ID:您的 Google Cloud 项目 ID。
  • PAGE_SIZE:可选。要包含在响应中的账号群组数量。 默认值为 50,最大值为 1,000。如果账号群组数量大于页面大小,则响应中会包含分页令牌,您可以使用该令牌检索下一页结果。
  • NEXT_PAGE_TOKEN:可选。此方法之前的响应中返回的 nextPageToken 值。指定此参数可查询更多账号群组。

HTTP 方法和网址:

GET https://recaptchaenterprise.googleapis.com/v1/projects/PROJECT_ID/relatedaccountgroups?page_size=PAGE_SIZE&page_token=NEXT_PAGE_TOKEN

如需发送请求,请选择以下方式之一:

curl

执行以下命令:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://recaptchaenterprise.googleapis.com/v1/projects/PROJECT_ID/relatedaccountgroups?page_size=PAGE_SIZE&page_token=NEXT_PAGE_TOKEN"

PowerShell

执行以下命令:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://recaptchaenterprise.googleapis.com/v1/projects/PROJECT_ID/relatedaccountgroups?page_size=PAGE_SIZE&page_token=NEXT_PAGE_TOKEN" | Select-Object -Expand Content

您应该收到类似以下内容的 JSON 响应:

{
  "relatedAccountGroups": [
    {
      "name": "projects/projectId/relatedaccountgroups/groupId1"
    },
    {
      "name": "projects/projectId/relatedaccountgroups/groupId2"
    }
  ],
  "nextPageToken": "BenimQwKzIOibbOO2Lhisw"
}

代码示例

检索相关的账号群组成员资格

要检索具有类似行为的账号群组成员资格列表,请使用 relatedaccountgroupmemberships.list 方法。

在使用任何请求数据之前,请先进行以下替换:

  • PROJECT_ID:您的 Google Cloud 项目 ID。
  • GROUP_ID:您要为其查找相关成员资格的账号群组的名称。
  • PAGE_SIZE:可选。要包含在响应中的账号群组成员资格的数量。 默认值为 50,最大值为 1,000。如果账号群组成员资格数量大于页面大小,则响应中会包含分页令牌,您可以使用该令牌检索下一页结果。
  • NEXT_PAGE_TOKEN:可选。此方法的先前响应中返回的 nextPageToken 值。指定此参数可查询更多帐号群组成员资格。

HTTP 方法和网址:

GET https://recaptchaenterprise.googleapis.com/v1/projects/PROJECT_ID/relatedaccountgroups/GROUP_ID/memberships?page_size=PAGE_SIZE&page_token=NEXT_PAGE_TOKEN

如需发送请求,请选择以下方式之一:

curl

执行以下命令:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://recaptchaenterprise.googleapis.com/v1/projects/PROJECT_ID/relatedaccountgroups/GROUP_ID/memberships?page_size=PAGE_SIZE&page_token=NEXT_PAGE_TOKEN"

PowerShell

执行以下命令:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://recaptchaenterprise.googleapis.com/v1/projects/PROJECT_ID/relatedaccountgroups/GROUP_ID/memberships?page_size=PAGE_SIZE&page_token=NEXT_PAGE_TOKEN" | Select-Object -Expand Content

您应该收到类似以下内容的 JSON 响应:

{
  "relatedAccountGroupMemberships": [
    {
      "name": "projects/projectId/relatedaccountgroups/groupId/memberships/membershipId1",
      "accountId": "4RopXS59"
    },
    {
      "name": "projects/projectId/relatedaccountgroups/groupId/memberships/membershipId2",
      "accountId": "HVMv1DTb"
    }
  ],
  "nextPageToken": "WPuIn8GHU3JvcJqgvmE7Aw"
}

代码示例

后续步骤