AuthenticationDialogRequest QML Type | Qt WebEngine 5.10

Qt 5.10 | Qt WebEngine | QML Types | AuthenticationDialogRequest QML Type

Qt 5.10.1 Reference Documentation

# AuthenticationDialogRequest QML Type

A request for providing authentication credentials required by proxies or HTTP servers. More...

Import Statement: | import QtWebEngine 1.5
Since: | QtWebEngine 1.4

- List of all members, including inherited members

## Properties

- accepted : bool
- proxyHost : string
- realm : string
- type : enumeration
- url : url

## Methods

- void dialogAccept(string username, string password)
- void dialogReject()

## Detailed Description

An AuthenticationDialogRequest is passed as an argument of the WebEngineView::authenticationDialogRequested signal. It is generated when basic HTTP or proxy authentication is required. The type of authentication can be checked with the type property.

The accepted property of the request indicates whether the request is handled by the user code or the default dialog should be displayed. If you set the accepted property to `true`, make sure to call either dialogAccept() or dialogReject() afterwards.

The following code uses a custom dialog to handle the request:

      WebEngineView {
          // ...
          onAuthenticationDialogRequested: function(request) {
              request.accepted = true;
              myDialog.request = request // keep the reference to the request
              myDialog.accept.connect(request.dialogAccept);
              myDialog.reject.connect(request.dialogReject);
              myDialog.visible = true;
          }
          // ...
      }

## Property Documentation

accepted : bool

Indicates whether the authentication dialog request has been accepted by the signal handler.

If the property is `false` after any signal handlers for WebEngineView::authenticationDialogRequested have been executed, a default authentication dialog will be shown. To prevent this, set `request.accepted` to `true`.

The default is `false`.

[read-only] proxyHost : string

The hostname of the authentication proxy. Empty if type is AuthenticationTypeHTTP.

[read-only] realm : string

The HTTP authentication realm attribute value of the `WWW-Authenticate` header. Empty if type is AuthenticationTypeProxy.

[read-only] type : enumeration

The type of the authentication request.

Constant | Description
--- | ---
`WebEngineAuthenticationDialogRequest.AuthenticationTypeHTTP` | HTTP authentication.
`WebEngineAuthenticationDialogRequest.AuthenticationTypeProxy` | Proxy authentication.

[read-only] url : url

The URL of the HTTP request for which authentication was requested. In case of proxy authentication, this is a request URL which is proxied via host.

See also proxyHost.

## Method Documentation

void dialogAccept(string username, string password)

This function notifies the engine that the user accepted the dialog, providing the username and the password required for authentication.

void dialogReject()

This function notifies the engine that the user rejected the dialog and the authentication shall not proceed.