### Method

# Gio TlsInteraction invoke_request_certificate

since: 2.40

#### Declaration

    GTlsInteractionResult
    g_tls_interaction_invoke_request_certificate (
      GTlsInteraction* interaction,
      GTlsConnection* connection,
      GTlsCertificateRequestFlags flags,
      GCancellable* cancellable,
      GError** error
    )

#### Description

Invoke the interaction to ask the user to choose a certificate to use with the connection. It invokes this interaction in the main loop, specifically the `GMainContext` returned by `g_main_context_get_thread_default()` when the interaction is created. This is called by called by `GTlsConnection` when the peer requests a certificate during the handshake.

Derived subclasses usually implement a certificate selector, although they may also choose to provide a certificate from elsewhere. Alternatively the user may abort this certificate request, which may or may not abort the TLS connection.

The implementation can either be a synchronous (eg: modal dialog) or an asynchronous one (eg: modeless dialog). This function will take care of calling which ever one correctly.

If the interaction is cancelled by the cancellation object, or by the user then `G_TLS_INTERACTION_FAILED` will be returned with an error that contains a `G_IO_ERROR_CANCELLED` error code. Certain implementations may not support immediate cancellation.

Available since: 2.40

#### Parameters

`connection`

  Type: `GTlsConnection`

  A `GTlsConnection` object.

  The data is owned by the caller of the method.

`flags`

  Type: `GTlsCertificateRequestFlags`

  Flags providing more information about the request.

`cancellable`

  Type: `GCancellable`

  An optional `GCancellable` cancellation object.

  The argument can be `NULL`.
  The data is owned by the caller of the method.

`error`

  Type: `GError **`

  The return location for a recoverable error.

  The argument can be `NULL`.
  If the return location is not `NULL`, then you must initialize it to a `NULL` `GError*`.
  The argument will be left initialized to `NULL` by the method if there are no errors.
  In case of error, the argument will be set to a newly allocated `GError`; the caller will take ownership of the data, and be responsible for freeing it.

#### Return value

Type: `GTlsInteractionResult`

The status of the certificate request interaction.