VerificationResult
Stay organized with collections
Save and categorize content based on your preferences.
Immmutable object to hold the result of a verification operation. This object can be in
three possible states:
Status |
Condition |
Expected results |
Succeeded |
getVerificationStatus().equals(CommonStatusCodes.SUCCESS) |
In this state verificationHandle() will be absent but
recaptchaToken() will not. The token can be used with the reCAPTCHA
Enterprise server to verify that the account is indeed verified. |
Aborted |
getVerificationStatus().equals(RecaptchaStatusCodes.RECAPTCHA_2FA_ABORTED) |
In this state verificationHandle() will be absent but
recaptchaToken() will not. In this case reCAPTCHA server has aborted the
operation, and more information on the reasons of the abortion can be obtained by calling
the reCAPTCHA Enterprise server with the token. |
Failed |
!getVerificationStatus().equals(CommonStatusCodes.SUCCESS) &&
!getVerificationStatus().equals(RecaptchaStatusCodes.RECAPTCHA_2FA_ABORTED) |
In this state recaptchaToken() will be absent but
verificationHandle() will not, to allow for additional retries. |
Public Constructor Summary
Inherited Method Summary
From class java.lang.Object
Object
|
clone()
|
boolean |
|
void |
finalize()
|
final Class<?>
|
getClass()
|
int |
hashCode()
|
final void |
notify()
|
final void |
notifyAll()
|
String
|
toString()
|
final void |
wait(long arg0, int arg1)
|
final void |
wait(long arg0)
|
final void |
wait()
|
Public Constructors
public VerificationResult ()
Public Methods
public abstract Status
getVerificationStatus ()
Returns a status to provide more info on the result of the verification
operation.
Returns
CommonStatusCodes.SUCCESS
or
RecaptchaStatusCodes.RECAPTCHA_2FA_ABORTED
status if the verification
operation succeeded, and non-success status (e.g.
RecaptchaStatusCodes.RECAPTCHA_2FA_PIN_MISMATCH
) if the verification
failed with more attempts available, i.e. user entered wrong pin.
Returns an optional containing the reCAPTCHA token if the verification operation was
successful or aborted.
Returns
- the reCAPTCHA token if
getVerificationStatus().equals(
CommonStatusCodes.SUCCESS)
or getVerificationStatus().equals(
RecaptchaStatusCodes.RECAPTCHA_2FA_ABORTED)
, otherwise an empty RecaptchaOptionalObject
.
Returns an optional containing a verification handle if the verification operation
failed and the client is allowed to retry.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-31 UTC."],[[["\u003cp\u003e\u003ccode\u003eVerificationResult\u003c/code\u003e is an immutable object representing the outcome of a reCAPTCHA verification operation, with three possible states: Succeeded, Aborted, and Failed.\u003c/p\u003e\n"],["\u003cp\u003eA successful or aborted verification provides a reCAPTCHA token via \u003ccode\u003erecaptchaToken()\u003c/code\u003e for server-side validation.\u003c/p\u003e\n"],["\u003cp\u003eA failed verification may provide a \u003ccode\u003everificationHandle()\u003c/code\u003e via \u003ccode\u003everificationHandle()\u003c/code\u003e to allow for retries.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egetVerificationStatus()\u003c/code\u003e method returns a status code indicating the result of the verification operation (e.g., \u003ccode\u003eCommonStatusCodes.SUCCESS\u003c/code\u003e, \u003ccode\u003eRecaptchaStatusCodes.RECAPTCHA_2FA_ABORTED\u003c/code\u003e, or other error codes).\u003c/p\u003e\n"]]],[],null,["# VerificationResult\n\npublic abstract class **VerificationResult** extends [Object](//developer.android.com/reference/java/lang/Object.html) \nImmmutable object to hold the result of a verification operation. This object can be in\nthree possible states:\n\n| Status | Condition | Expected results |\n|-----------|---------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Succeeded | `getVerificationStatus().equals(CommonStatusCodes.SUCCESS)` | In this state `verificationHandle()` will be absent but `recaptchaToken()` will not. The token can be used with the reCAPTCHA Enterprise server to verify that the account is indeed verified. |\n| Aborted | `getVerificationStatus().equals(RecaptchaStatusCodes.RECAPTCHA_2FA_ABORTED)` | In this state `verificationHandle()` will be absent but `recaptchaToken()` will not. In this case reCAPTCHA server has aborted the operation, and more information on the reasons of the abortion can be obtained by calling the reCAPTCHA Enterprise server with the token. |\n| Failed | `!getVerificationStatus().equals(CommonStatusCodes.SUCCESS) && !getVerificationStatus().equals(RecaptchaStatusCodes.RECAPTCHA_2FA_ABORTED)` | In this state `recaptchaToken()` will be absent but `verificationHandle()` will not, to allow for additional retries. |\n\n### Public Constructor Summary\n\n|---|---------------------------------------------------------------------------------------------------------------------|\n| | [VerificationResult](/android/reference/com/google/android/gms/recaptcha/VerificationResult#VerificationResult())() |\n\n### Public Method Summary\n\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract Status | [getVerificationStatus](/android/reference/com/google/android/gms/recaptcha/VerificationResult#getVerificationStatus())() Returns a status to provide more info on the result of the verification operation. |\n| abstract [RecaptchaOptionalObject](/android/reference/com/google/android/gms/recaptcha/RecaptchaOptionalObject)\\\u003c[String](//developer.android.com/reference/java/lang/String.html)\\\u003e | [recaptchaToken](/android/reference/com/google/android/gms/recaptcha/VerificationResult#recaptchaToken())() Returns an optional containing the reCAPTCHA token if the verification operation was successful or aborted. |\n| abstract [RecaptchaOptionalObject](/android/reference/com/google/android/gms/recaptcha/RecaptchaOptionalObject)\\\u003c[VerificationHandle](/android/reference/com/google/android/gms/recaptcha/VerificationHandle)\\\u003e | [verificationHandle](/android/reference/com/google/android/gms/recaptcha/VerificationResult#verificationHandle())() Returns an optional containing a verification handle if the verification operation failed and the client is allowed to retry. |\n\n### Inherited Method Summary\n\nFrom class java.lang.Object \n\n|----------------------------------------------------------------------------|--------------------------------------------------------------------------------|\n| [Object](//developer.android.com/reference/java/lang/Object.html) | clone() |\n| boolean | equals([Object](//developer.android.com/reference/java/lang/Object.html) arg0) |\n| void | finalize() |\n| final [Class](//developer.android.com/reference/java/lang/Class.html)\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| [String](//developer.android.com/reference/java/lang/String.html) | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nPublic Constructors\n-------------------\n\n#### public **VerificationResult** ()\n\nPublic Methods\n--------------\n\n#### public abstract Status\n**getVerificationStatus** ()\n\nReturns a status to provide more info on the result of the verification\noperation. \n\n##### Returns\n\n- `CommonStatusCodes.SUCCESS` or `RecaptchaStatusCodes.RECAPTCHA_2FA_ABORTED` status if the verification operation succeeded, and non-success status (e.g. `RecaptchaStatusCodes.RECAPTCHA_2FA_PIN_MISMATCH`) if the verification failed with more attempts available, i.e. user entered wrong pin. \n\n#### public abstract [RecaptchaOptionalObject](/android/reference/com/google/android/gms/recaptcha/RecaptchaOptionalObject)\\\u003c[String](//developer.android.com/reference/java/lang/String.html)\\\u003e\n**recaptchaToken** ()\n\nReturns an optional containing the reCAPTCHA token if the verification operation was\nsuccessful or aborted. \n\n##### Returns\n\n- the reCAPTCHA token if `getVerificationStatus().equals(\n CommonStatusCodes.SUCCESS)` or `getVerificationStatus().equals(\nRecaptchaStatusCodes.RECAPTCHA_2FA_ABORTED)`, otherwise an empty [RecaptchaOptionalObject](/android/reference/com/google/android/gms/recaptcha/RecaptchaOptionalObject). \n\n#### public abstract [RecaptchaOptionalObject](/android/reference/com/google/android/gms/recaptcha/RecaptchaOptionalObject)\\\u003c[VerificationHandle](/android/reference/com/google/android/gms/recaptcha/VerificationHandle)\\\u003e\n**verificationHandle** ()\n\nReturns an optional containing a verification handle if the verification operation\nfailed and the client is allowed to retry. \n\n##### Returns\n\n- a verification handle on a failure status, otherwise an empty [RecaptchaOptionalObject](/android/reference/com/google/android/gms/recaptcha/RecaptchaOptionalObject)."]]