# WebauthnApprovalFlows

## Methods

### modal

▸ **modal**(`params`): `Promise`<`string`>

Invokes a WebAuthn approval, including prompting the user to select from a list of registered credentials, and then prompting the user for biometrics. The credentials list is displayed using the native browser modal.
This call must be invoked for a registered username. If the target username is not registered or in case of any other failure, an SdkError will be thrown.
If approval is completed successfully, this call will return a promise that resolves to the credential result, which is an object encoded as a base64 string. This encoded result should then be passed to the [backend authentication endpoint](/openapi/user/backend-webauthn.openapi/other/authenticatewebauthncredential) to retrieve user tokens.

**`Throws`**

[NotInitialized](/sdk-ref/authnsdk/enums/errorcode#notinitialized)

**`Throws`**

[InvalidApprovalData](/sdk-ref/authnsdk/enums/errorcode#invalidapprovaldata)

**`Throws`**

[AuthenticationFailed](/sdk-ref/authnsdk/enums/errorcode#authenticationfailed)

**`Throws`**

[AuthenticationCanceled](/sdk-ref/authnsdk/enums/errorcode#authenticationcanceled)

**`Throws`**

[AuthenticationProcessAlreadyActive](/sdk-ref/authnsdk/enums/errorcode#authenticationprocessalreadyactive)

#### Parameters

| Name | Type | Description |
|  --- | --- | --- |
| `params` | `Object` | - |
| `params.username` | `undefined` | `string` | Name of user account, as used in the WebAuthn registration. |
| `params.approvalData` | `Record`<`string`, `string`> | Data that represents the approval to be signed with a passkey |


#### Returns

`Promise`<`string`>

Base64-encoded object, which contains the credential result. This encoded result will be used to fetch user tokens via the [backend authentication endpoint](/openapi/user/backend-webauthn.openapi/other/authenticatewebauthncredential).