IdConfiguration constructor

IdConfiguration({
  1. required String client_id,
  2. bool? auto_select,
  3. CallbackFn? callback,
  4. Uri? login_uri,
  5. NativeCallbackFn? native_callback,
  6. bool? cancel_on_tap_outside,
  7. String? prompt_parent_id,
  8. String? nonce,
  9. OneTapContext? context,
  10. String? state_cookie_domain,
  11. UxMode? ux_mode,
  12. List<String>? allowed_parent_origin,
  13. VoidFn? intermediate_iframe_close_callback,
  14. bool? itp_support,
  15. String? login_hint,
  16. String? hd,
  17. bool? use_fedcm_for_prompt,
})

Constructs a IdConfiguration object in JavaScript.

Implementation

factory IdConfiguration({
  /// Your application's client ID, which is found and created in the Google
  /// Developers Console.
  required String client_id,

  /// Determines if an ID token is automatically returned without any user
  /// interaction when there's only one Google session that has approved your
  /// app before. The default value is `false`.
  bool? auto_select,

  /// The function that handles the ID token returned from the One Tap prompt
  /// or the pop-up window. This attribute is required if Google One Tap or
  /// the Sign In With Google button `popup` UX mode is used.
  CallbackFn? callback,

  /// This attribute is the URI of your login endpoint. May be omitted if the
  /// current page is your login page, in which case the credential is posted
  /// to this page by default.
  ///
  /// The ID token credential response is posted to your login endpoint when
  /// a user clicks on the Sign In With Google button and `redirect` UX mode
  /// is used.
  ///
  /// Your login endpoint must handle POST requests containing a credential
  /// key with an ID token value in the body.
  Uri? login_uri,

  /// The function that handles the password credential returned from the
  /// browser's native credential manager.
  NativeCallbackFn? native_callback,

  /// Whether or not to cancel the One Tap request if a user clicks outside
  /// the prompt. The default value is `true`.
  bool? cancel_on_tap_outside,

  /// The DOM ID of the container element. If it's not set, the One Tap prompt
  /// is displayed in the top-right corner of the window.
  String? prompt_parent_id,

  /// A random string used by the ID token to prevent replay attacks.
  ///
  /// Nonce length is limited to the maximum JWT size supported by your
  /// environment, and individual browser and server HTTP size constraints.
  String? nonce,

  /// Changes the text of the title and messages in the One Tap prompt.
  OneTapContext? context,

  /// If you need to display One Tap in the parent domain and its subdomains,
  /// pass the parent domain to this field so that a single shared-state
  /// cookie is used.
  ///
  /// See: https://developers.google.com/identity/gsi/web/guides/subdomains
  String? state_cookie_domain,

  /// Set the UX flow used by the Sign In With Google button. The default
  /// value is `popup`. **This attribute has no impact on the OneTap UX.**
  UxMode? ux_mode,

  /// The origins that are allowed to embed the intermediate iframe. One Tap
  /// will run in the intermediate iframe mode if this field presents.
  ///
  /// Wildcard prefixes are also supported. Wildcard domains must begin with
  /// a secure `https://` scheme, otherwise they'll be considered invalid.
  List<String>? allowed_parent_origin,

  /// Overrides the default intermediate iframe behavior when users manually
  /// close One Tap by tapping on the 'X' button in the One Tap UI. The
  /// default behavior is to remove the intermediate iframe from the DOM
  /// immediately.
  ///
  /// The `intermediate_iframe_close_callback` field takes effect only in
  /// intermediate iframe mode. And it has impact only to the intermediate
  /// iframe, instead of the One Tap iframe. The One Tap UI is removed before
  /// the callback is invoked.
  VoidFn? intermediate_iframe_close_callback,

  /// Determines if the upgraded One Tap UX should be enabled on browsers
  /// that support Intelligent Tracking Prevention (ITP). The default value
  /// is false.
  ///
  /// See: https://developers.google.com/identity/gsi/web/guides/features#upgraded_ux_on_itp_browsers
  bool? itp_support,

  /// If your application knows in advance which user should be signed-in, it
  /// can provide a login hint to Google.
  ///
  /// When successful, account selection is skipped. Accepted values are:
  ///   * an email address or
  ///   * an ID token sub field value.
  ///
  /// For more information, see:
  ///   * https://developers.google.com/identity/protocols/oauth2/openid-connect#authenticationuriparameters
  String? login_hint,

  /// When a user has multiple accounts and should only sign-in with their
  /// Workspace account use this to provide a domain name hint to Google.
  ///
  /// When successful, user accounts displayed during account selection are
  /// limited to the provided domain.
  ///
  /// A wildcard value: `*` offers only Workspace accounts to the user and
  /// excludes consumer accounts (user@gmail.com) during account selection.
  ///
  /// For more information, see:
  ///   * https://developers.google.com/identity/protocols/oauth2/openid-connect#authenticationuriparameters
  String? hd,

  /// Allow the browser to control user sign-in prompts and mediate the
  /// sign-in flow between your website and Google. Defaults to false.
  bool? use_fedcm_for_prompt,
}) {
  return IdConfiguration._toJS(
    client_id: client_id.toJS,
    auto_select: auto_select?.toJS,
    callback: callback?.toJS,
    login_uri: login_uri?.toString().toJS,
    native_callback: native_callback?.toJS,
    cancel_on_tap_outside: cancel_on_tap_outside?.toJS,
    prompt_parent_id: prompt_parent_id?.toJS,
    nonce: nonce?.toJS,
    context: context?.toString().toJS,
    state_cookie_domain: state_cookie_domain?.toJS,
    ux_mode: ux_mode?.toString().toJS,
    allowed_parent_origin:
        allowed_parent_origin?.map((String s) => s.toJS).toList().toJS,
    intermediate_iframe_close_callback:
        intermediate_iframe_close_callback?.toJS,
    itp_support: itp_support?.toJS,
    login_hint: login_hint?.toJS,
    hd: hd?.toJS,
    use_fedcm_for_prompt: use_fedcm_for_prompt?.toJS,
  );
}