# WebauthnAuthenticationFlows

## Methods

### modal

▸ **modal**({`username?`, `options?`}): `Promise`<`string`>

Invokes a WebAuthn authentication, 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.
If username isn't provided, it will promote a modal with a list of all discoverable credentials on the device. If username is provided, 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 authentication 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`**

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

**`Throws`**

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

**`Throws`**

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

**`Throws`**

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

#### Parameters

| Name | Type | Description |
|  --- | --- | --- |
| `username?` | `string` | Name of user account, as used in the WebAuthn registration. If not provided, the authentication will start without the context of a user and it will be inferred by the chosen passkey |


| `options?` | [`WebauthnAuthenticationOptions`](/sdk-ref/authnsdk/interfaces/webauthnauthenticationoptions) | [WebauthnAuthenticationOptions](/sdk-ref/authnsdk/interfaces/webauthnauthenticationoptions) Options for the authentication process |

#### 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).

## Properties

### autofill

• **autofill**: [`AutofillHandlers`](/sdk-ref/authnsdk/interfaces/autofillhandlers)

Property used to implement credential selection via autofill UI.