RecaptchaVerifier class

AnreCAPTCHA-based application verifier.

RecaptchaVerifier does not work in a Node.js environment.

Signature:

exportdeclareclassRecaptchaVerifierimplementsApplicationVerifierInternal

Implements: ApplicationVerifierInternal

Constructors

ConstructorModifiersDescription
(constructor)(authExtern, containerOrId, parameters)Constructs a new instance of theRecaptchaVerifier class

Properties

PropertyModifiersTypeDescription
type(not declared)The application verifier type.

Methods

MethodModifiersDescription
clear()Clears the reCAPTCHA widget from the page and destroys the instance.
render()Renders the reCAPTCHA widget on the page.
verify()Waits for the user to solve the reCAPTCHA and resolves with the reCAPTCHA token.

RecaptchaVerifier.(constructor)

Constructs a new instance of theRecaptchaVerifier class

Check the reCAPTCHA docs for a comprehensive list. All parameters are accepted except for the sitekey. Firebase Auth backend provisions a reCAPTCHA for each project and will configure this upon rendering. For an invisible reCAPTCHA, a size key must have the value 'invisible'.

Signature:

constructor(authExtern:Auth,containerOrId:HTMLElement|string,parameters?:RecaptchaParameters);

Parameters

ParameterTypeDescription
authExternAuthThe corresponding FirebaseAuth instance.
containerOrIdHTMLElement | stringThe reCAPTCHA container parameter.
parametersRecaptchaParametersThe optional reCAPTCHA parameters.

RecaptchaVerifier.type

The application verifier type.

For a reCAPTCHA verifier, this is 'recaptcha'.

Signature:

readonlytype="recaptcha";

RecaptchaVerifier.clear()

Clears the reCAPTCHA widget from the page and destroys the instance.

Signature:

clear():void;

Returns:

void

RecaptchaVerifier.render()

Renders the reCAPTCHA widget on the page.

Signature:

render():Promise<number>;

Returns:

Promise<number>

A Promise that resolves with the reCAPTCHA widget ID.

RecaptchaVerifier.verify()

Waits for the user to solve the reCAPTCHA and resolves with the reCAPTCHA token.

Signature:

verify():Promise<string>;

Returns:

Promise<string>

A Promise for the reCAPTCHA token.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024-01-19 UTC.