> For the complete documentation index, see [llms.txt](https://docs.ont.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ont.io/decentralized-identity-and-data/ontid/ont-login/ui-sdk/api-reference.md).

# API Reference

## Parameters

| Name                     | Type     | Description                                                                                                                                                                                       |
| ------------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `url_of_get_challenge`   | `string` | URL of server API to get challenge, see details below                                                                                                                                             |
| `url_of_submit_response` | `string` | URL of server API to submit response, see details below                                                                                                                                           |
| `show_vc_list`           | `string` | 'true'\|'false'. Show a list of VC in the dialog if exists                                                                                                                                        |
| `test`                   | `string` | 'true' \| 'false'. Add a button to mock the successful scan result (test only)                                                                                                                    |
| `action`                 | `string` | '0' \| '1'. "0" = authentication; "1" = authentication and authorization. More details [here](/decentralized-identity-and-data/ontid/ont-login/protocol-specification.md#authentication-request). |

### url\_of\_get\_challenge

Gets challenge with `AuthRequest`.

#### Request&#x20;

| Content Type       | Format                                                                                                           | Example                                         |
| ------------------ | ---------------------------------------------------------------------------------------------------------------- | ----------------------------------------------- |
| `application/json` | [AuthRequest](/decentralized-identity-and-data/ontid/ont-login/protocol-specification.md#authentication-request) | `{"ver":"1.0","type":"ClientHello","action":0}` |

#### Response

| Content Type       | Format                                                                                                                | Example                                                                                                                                                                                                                                                                                                                      |
| ------------------ | --------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `application/json` | [AuthChallenge ](/decentralized-identity-and-data/ontid/ont-login/protocol-specification.md#authentication-challenge) | `{"ver":"1.0","type":"ServerHello","nonce":"8125419d-0ba4-11ec-a4f0-441ca8e37c61","server":{"name":"testServcer","icon":"http://somepic.jpg","url":"https://ont.io","did":"did:ont:sampletest"},"chain":["ONT"],"alg":["ES256"],"VCFilters":[{"type":"EmailCredential","trust_roots":["did:ont:testdid"],"required":true}]}` |

### `url_of_submit_response`

Submits `AuthResponse` to the server

#### Request&#x20;

| Content Type       | Format                                                                                                              | Example                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ------------------ | ------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `application/json` | [AuthResponse ](/decentralized-identity-and-data/ontid/ont-login/protocol-specification.md#authentication-response) | `{"ver":"1.0","type":"ClientResponse","nonce":"221b111a-0ba5-11ec-a4f0-441ca8e37c61","did":"did:ont:AR9NDnK3iMSZodbENnt7eX5TJ2s27fnHra","proof":{"type":"Ed25519","verificationMethod":"did:ont:AR9NDnK3iMSZodbENnt7eX5TJ2s27fnHra#key-1","created":1630556445,"value":"01c3841e922884df9288dde3c1fecbb575482c834560781454c44192b54140d3a7413d116fe81b76e3e74f88e2eb1351c120854d47189241545f66d7702cab8523"},"VPs":[]}` |

#### Response

JSON messages.

## Events

| Name      | Type          | Description                                                                             |
| --------- | ------------- | --------------------------------------------------------------------------------------- |
| `success` | `CustomEvent` | Callback submitted successfully, with response to`url_of_submit_response` in `e.detail` |
| `error`   | `CustomEvent` | Error callback.                                                                         |
| `cancel`  | `CustomEvent` | Callback cancelled by user.                                                             |
