# WebauthnCrossDeviceFlows

## Properties

### init

• **init**: `Object`

Initializes a cross device flow, such as when users request to login to a desktop using their mobile device. Once invoked, the SDK will start listening for events occurring on the other device,
and calls your handlers when a state change is detected.
These methods return a promise that resolves to a [CrossDeviceController](/sdk-ref/authnsdk/interfaces/crossdevicecontroller) object, which allows you to stop listening to events and includes the cross-device ticket ID which is used when attaching another device to the flow.

#### Type declaration

| Name | Type |
|  --- | --- |
| `registration` | (`params`: { `crossDeviceTicketId`: `string` ; `handlers`: [`CrossDeviceRegistrationHandlers`](/sdk-ref/authnsdk/interfaces/crossdeviceregistrationhandlers)  }) => `Promise`<[`CrossDeviceController`](/sdk-ref/authnsdk/interfaces/crossdevicecontroller)> |
| `authentication` | (`params`: { `username?`: `string` ; `handlers`: [`CrossDeviceAuthenticationHandlers`](/sdk-ref/authnsdk/interfaces/crossdeviceauthenticationhandlers)  }) => `Promise`<[`CrossDeviceController`](/sdk-ref/authnsdk/interfaces/crossdevicecontroller)> |
| `approval` | (`params`: { `username`: `string` ; `approvalData`: `Record`<`string`, `string`> ; `handlers`: [`CrossDeviceAuthenticationHandlers`](/sdk-ref/authnsdk/interfaces/crossdeviceauthenticationhandlers)  }) => `Promise`<[`CrossDeviceController`](/sdk-ref/authnsdk/interfaces/crossdevicecontroller)> |


### authenticate

• **authenticate**: `Object`

#### Type declaration

| Name | Type |
|  --- | --- |
| `modal` | (`crossDeviceTicketId`: `string`) => `Promise`<`string`> |


### approve

• **approve**: `Object`

#### Type declaration

| Name | Type |
|  --- | --- |
| `modal` | (`crossDeviceTicketId`: `string`) => `Promise`<`string`> |


### register

• **register**: (`params`: { `crossDeviceTicketId`: `string` ; `options?`: [`WebauthnCrossDeviceRegistrationOptions`](/sdk-ref/authnsdk/interfaces/webauthncrossdeviceregistrationoptions)  }) => `Promise`<`string`>

#### Type declaration

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

Invokes a WebAuthn credential registration for the user used in the cross device session init, including prompting the user for biometrics.
If registration 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 relevant backend registration endpoint to complete the registration for either a [logged-in user](/openapi/user/backend-webauthn.openapi/other/webauthn-registration) or [logged-out user](/openapi/user/backend-webauthn.openapi/other/webauthn-registration-external).
If registration fails, an SdkError will be thrown.
If the backend registration call was successful, [onCredentialRegister](/sdk-ref/authnsdk/interfaces/crossdeviceregistrationhandlers#oncredentialregister) will be called.

**`Throws`**

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

**`Throws`**

[RegistrationFailed](/sdk-ref/authnsdk/enums/errorcode#registrationfailed)

**`Throws`**

[RegistrationCanceled](/sdk-ref/authnsdk/enums/errorcode#registrationcanceled)

##### Parameters

| Name | Type |
|  --- | --- |
| `params` | `Object` |
| `params.crossDeviceTicketId` | `string` |
| `params.options?` | [`WebauthnCrossDeviceRegistrationOptions`](/sdk-ref/authnsdk/interfaces/webauthncrossdeviceregistrationoptions) |


##### Returns

`Promise`<`string`>

### attachDevice

• **attachDevice**: (`crossDeviceTicketId`: `string`) => `Promise`<[`AttachDeviceResult`](/sdk-ref/authnsdk/interfaces/attachdeviceresult)>

#### Type declaration

▸ (`crossDeviceTicketId`): `Promise`<[`AttachDeviceResult`](/sdk-ref/authnsdk/interfaces/attachdeviceresult)>

Indicates when a session is accepted on another device in cross-device flows.

If successful,[onDeviceAttach](/sdk-ref/authnsdk/interfaces/crossdeviceregistrationhandlers#ondeviceattach) will be called in registration flow and [onDeviceAttach](/sdk-ref/authnsdk/interfaces/crossdeviceauthenticationhandlers#ondeviceattach) for authentication.

##### Parameters

| Name | Type | Description |
|  --- | --- | --- |
| `crossDeviceTicketId` | `string` | Ticket ID of the cross-device flow. retrieved from the [CrossDeviceController](/sdk-ref/authnsdk/interfaces/crossdevicecontroller) object. |


##### Returns

`Promise`<[`AttachDeviceResult`](/sdk-ref/authnsdk/interfaces/attachdeviceresult)>

AttachDeviceResult [AttachDeviceResult](/sdk-ref/authnsdk/interfaces/attachdeviceresult). Object containing the ticket status, creation timestamp, and approval data (if passed in the init.authentication() call)