• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Class (HttpAuthHandler)
2
3Implements the **HttpAuthHandler** object. For details about the sample code, see [onHttpAuthRequest](./arkts-basic-components-web-events.md#onhttpauthrequest9).
4
5> **NOTE**
6>
7> - The initial APIs of this component are supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
8>
9> - The initial APIs of this class are supported since API version 9.
10>
11> - You can preview how this component looks on a real device, but not in DevEco Studio Previewer.
12
13## constructor<sup>9+</sup>
14
15constructor()
16
17Constructs an **HttpAuthHandler**.
18
19**System capability**: SystemCapability.Web.Webview.Core
20
21## cancel<sup>9+</sup>
22
23cancel(): void
24
25Cancels HTTP authentication as requested by the user.
26
27**System capability**: SystemCapability.Web.Webview.Core
28
29## confirm<sup>9+</sup>
30
31confirm(userName: string, password: string): boolean
32
33Performs HTTP authentication with the user name and password provided by the user.
34
35**System capability**: SystemCapability.Web.Webview.Core
36
37**Parameters**
38
39| Name     | Type  | Mandatory | Description      |
40| -------- | ------ | ---- | ---------- |
41| userName | string | Yes  | HTTP authentication user name.|
42| password      | string | Yes  | HTTP authentication password. |
43
44**Return value**
45
46| Type     | Description                   |
47| ------- | --------------------- |
48| boolean | **true** is returned if the authentication is successful; otherwise, **false** is returned.|
49
50## isHttpAuthInfoSaved<sup>9+</sup>
51
52isHttpAuthInfoSaved(): boolean
53
54Sets whether to use the account name and password cached on the server for authentication.
55
56**System capability**: SystemCapability.Web.Webview.Core
57
58**Return value**
59
60| Type     | Description                       |
61| ------- | ------------------------- |
62| boolean | **true** is returned if the authentication is successful; otherwise, **false** is returned.|
63