Warning: This data is provided under the Google User Data Policy. Please review and comply with the policy. Failure to do so may result in project suspension or account suspension.

Receive notifications on the prompt UI status

To facilitate your users to sign in or sign up, you can communicate with multiple identity providers to find available credentials. You might want to know our prompt UI status so that you can call the next identity provider.

To be notified about the prompt UI status at different moments, you can set a callback function name to the data-moment_callback attribute, or a function to the prompt() method if the JavaScript API is used.

Notifications are fired on the following moments:

  • Display moment: This occurs after the prompt() method is called. The notification contains a boolean value to indicate whether the UI is displayed or not.

  • Skipped moment: This occurs when the One Tap prompt is closed by an auto cancel, a manual cancel, or when Google fails to issue a credential, such as if the selected session has signed out of Google.

    In these cases, it's recommended that you continue on to the next identity providers, if there are any.

  • Dismissed moment: This occurs when a credential is successfully retrieved by Google or a user wants to stop the credential retrieval flow. For example, on your login dialog, when the user begins to input their username and password, you can call the google.accounts.id.cancel() method to close the One Tap prompt and trigger a dismissed moment.

The following code example implements the skipped moment:

  function continueWithNextIdp(notification) {
      if (notification.isNotDisplayed() || notification.isSkippedMoment()) {
          // try Next provider if One Tap is not displayed or skipped
<div id="g_id_onload"