사용자 응답 확인
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
이 페이지에서는 애플리케이션 백엔드에서 reCAPTCHA 챌린지에 대한 사용자의 응답을 확인하는 방법을 설명합니다.
웹 사용자의 경우 다음 세 가지 방법 중 하나로 사용자의 응답 토큰을 가져올 수 있습니다.
Android 라이브러리 사용자의 경우
SafetyNetApi.RecaptchaTokenResult.getTokenResult()
메서드를 사용하여 상태가 성공이 반환되면 응답 토큰을 가져올 수 있습니다.
토큰 제한사항
각 reCAPTCHA 사용자 응답 토큰은 2분 동안 유효하며 다음을 위해 한 번만 확인할 수 있습니다.
재전송 공격을 방지할 수 있습니다 새 토큰이 필요한 경우 reCAPTCHA 인증을 다시 실행하면 됩니다.
응답 토큰을 가져온 후에는 다음 API를 사용하여 2분 이내에 reCAPTCHA로 토큰을 확인하여 토큰이 유효한지 확인해야 합니다.
API 요청
URL: https://www.google.com/recaptcha/api/siteverify
METHOD: POST
POST 매개변수 |
설명 |
secret |
필수 항목입니다. 사이트와 reCAPTCHA 간에 공유된 키입니다. |
response |
필수 항목입니다. 사이트의 reCAPTCHA 클라이언트 측 통합에서 제공하는 사용자 응답 토큰입니다. |
remoteip |
선택사항입니다. 사용자의 IP 주소입니다. |
API 응답
응답은 JSON 객체입니다.
{
"success": true|false,
"challenge_ts": timestamp, // timestamp of the challenge load (ISO format yyyy-MM-dd'T'HH:mm:ssZZ)
"hostname": string, // the hostname of the site where the reCAPTCHA was solved
"error-codes": [...] // optional
}
reCAPTCHA Android의 경우:
{
"success": true|false,
"challenge_ts": timestamp, // timestamp of the challenge load (ISO format yyyy-MM-dd'T'HH:mm:ssZZ)
"apk_package_name": string, // the package name of the app where the reCAPTCHA was solved
"error-codes": [...] // optional
}
오류 코드 참조
오류 코드 |
설명 |
missing-input-secret |
보안 비밀 매개변수가 누락되었습니다. |
invalid-input-secret |
보안 비밀 매개변수가 올바르지 않거나 형식이 잘못되었습니다. |
missing-input-response |
응답 매개변수가 누락되었습니다. |
invalid-input-response |
응답 매개변수가 유효하지 않거나 형식이 잘못되었습니다. |
bad-request |
요청이 잘못되었거나 형식이 잘못되었습니다. |
timeout-or-duplicate |
응답이 더 이상 유효하지 않습니다. 너무 오래되었거나 이전에 사용된 것입니다. |
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-07-25(UTC)
[null,null,["최종 업데이트: 2025-07-25(UTC)"],[[["\u003cp\u003eThis page details how to verify if a user successfully completed a reCAPTCHA challenge on your website or Android app.\u003c/p\u003e\n"],["\u003cp\u003eYou'll receive a response token from the reCAPTCHA integration that needs to be verified within two minutes using the reCAPTCHA API.\u003c/p\u003e\n"],["\u003cp\u003eVerification involves sending a POST request to the reCAPTCHA API with the secret key, response token, and optionally, the user's IP address.\u003c/p\u003e\n"],["\u003cp\u003eThe API response is a JSON object indicating success or failure, along with details like timestamp and potential error codes.\u003c/p\u003e\n"],["\u003cp\u003eEach response token is valid for a single use and expires after two minutes to prevent replay attacks.\u003c/p\u003e\n"]]],["To verify a user's reCAPTCHA response, obtain the response token via the `g-recaptcha-response` parameter, `grecaptcha.getResponse()`, or a callback function for web users or the `SafetyNetApi.RecaptchaTokenResult.getTokenResult()` method for Android. Then, within two minutes, send a POST request to `https://www.google.com/recaptcha/api/siteverify` with `secret` (your site's key) and `response` (the user token). The optional `remoteip` can be included. The JSON response indicates success, timestamp, and hostname or `apk_package_name` if Android, and error codes if any.\n"],null,["# Verifying the user's response\n\nThis page explains how to verify a user's response to a reCAPTCHA challenge from your application's\nbackend.\n\nFor web users, you can get the user's response token in one of three ways:\n\n- `g-recaptcha-response` POST parameter when the user submits the form on your site\n- [`grecaptcha.getResponse(opt_widget_id)`](/recaptcha/docs/display#js_api) after the user completes the reCAPTCHA challenge\n- As a string argument to your [callback function](/recaptcha/docs/display#render_param) if `data-callback` is specified in either the `g-recaptcha` tag attribute or the callback parameter in the `grecaptcha.render` method\n\nFor Android library users, you can call the\n[SafetyNetApi.RecaptchaTokenResult.getTokenResult()](https://developers.google.com/android/reference/com/google/android/gms/safetynet/SafetyNetApi.RecaptchaTokenResult.html#getTokenResult())\nmethod to get response token if the status returns successful.\n\nToken Restrictions\n------------------\n\nEach reCAPTCHA user response token is valid for two minutes, and can only be verified *once* to\nprevent replay attacks. If you need a new token, you can re-run the reCAPTCHA verification.\n\nAfter you get the response token, you need to verify it within two minutes with reCAPTCHA using the\nfollowing API to ensure the token is valid.\n\nAPI Request\n-----------\n\nURL: `https://www.google.com/recaptcha/api/siteverify`\n\nMETHOD: `POST`\n\n| POST Parameter | Description |\n|----------------|---------------------------------------------------------------------------------------------------|\n| `secret` | Required. The shared key between your site and reCAPTCHA. |\n| `response` | Required. The user response token provided by the reCAPTCHA client-side integration on your site. |\n| `remoteip` | Optional. The user's IP address. |\n\nAPI Response\n------------\n\nThe response is a JSON object: \n\n {\n \"success\": true|false,\n \"challenge_ts\": timestamp, // timestamp of the challenge load (ISO format yyyy-MM-dd'T'HH:mm:ssZZ)\n \"hostname\": string, // the hostname of the site where the reCAPTCHA was solved\n \"error-codes\": [...] // optional\n }\n\nFor reCAPTCHA Android: \n\n {\n \"success\": true|false,\n \"challenge_ts\": timestamp, // timestamp of the challenge load (ISO format yyyy-MM-dd'T'HH:mm:ssZZ)\n \"apk_package_name\": string, // the package name of the app where the reCAPTCHA was solved\n \"error-codes\": [...] // optional\n }\n\n### Error code reference\n\n| Error code | Description |\n|--------------------------|---------------------------------------------------------------------------------|\n| `missing-input-secret` | The secret parameter is missing. |\n| `invalid-input-secret` | The secret parameter is invalid or malformed. |\n| `missing-input-response` | The response parameter is missing. |\n| `invalid-input-response` | The response parameter is invalid or malformed. |\n| `bad-request` | The request is invalid or malformed. |\n| `timeout-or-duplicate` | The response is no longer valid: either is too old or has been used previously. |"]]