An reCAPTCHA-based application verifier.

This class does not work in a Node.js environment.

param

The reCAPTCHA container parameter. This has different meaning depending on whether the reCAPTCHA is hidden or visible. For a visible reCAPTCHA the container must be empty. If a string is used, it has to correspond to an element ID. The corresponding element must also must be in the DOM at the time of initialization.

param

The optional reCAPTCHA parameters. 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'.

param

The corresponding Firebase app. If none is provided, the default Firebase App instance is used. A Firebase App instance must be initialized with an API key, otherwise an error will be thrown.

Implements

Index

Constructors

Properties

Methods

Constructors

constructor

Properties

type

type: string

The application verifier type. For a reCAPTCHA verifier, this is 'recaptcha'.

Methods

clear

  • clear ( ) : void
  • Clears the reCAPTCHA widget from the page and destroys the current instance.

    Returns void

render

  • render ( ) : Promise < number >
  • Renders the reCAPTCHA widget on the page.

    Returns Promise<number>

    A Promise that resolves with the reCAPTCHA widget ID.

verify

  • verify ( ) : Promise < string >
  • Waits for the user to solve the reCAPTCHA and resolves with the reCAPTCHA token.

    Returns Promise<string>

    A Promise for the reCAPTCHA token.