# Redirect to Mobile Module

<WebSDK2 />

The Redirect to Mobile module bridges desktop-initiated verifications to mobile devices: it generates a QR code (and optional SMS link) that hands the user off to their phone, where camera-bearing modules (selfie, ID capture) continue. Used when desktop browsers can't deliver the verification experience the customer needs.

> Combines [composite / orchestrator](doc:web-sdk-2-module-patterns#5-composite--orchestrator-modules) and [backend-process](doc:web-sdk-2-module-patterns#3-backend-process-modules) traits — fetches the redirect URL, polls onboarding status, and emits `finished` once the mobile device completes the flow.

## Tag

`<incode-redirect-to-mobile>` is a standard Web Component. Importing the UI subpath registers the custom element; importing the CSS applies the module's styles.

```ts
import '@incodetech/web/redirect-to-mobile';
import '@incodetech/web/redirect-to-mobile/styles.css';
```

## Properties

| Property   | Type                      | Required | Description                           |
| ---------- | ------------------------- | -------- | ------------------------------------- |
| `config`   | `RedirectToMobileConfig`  | ❌        | Configuration options                 |
| `onFinish` | `() => void`              | ❌        | Called when the mobile flow completes |
| `onError`  | `(error: string) => void` | ❌        | Called when an error occurs           |

## Configuration

```typescript
type RedirectToMobileConfig = {
  flowId?: string;
  url?: string;
  disableSmsOption?: boolean;
  addContinueToDesktop?: boolean;
  qrPhishingResistance?: boolean;
  authHint?: string;
  externalId?: string;
  lang?: string;
};
```

| Option                 | Type      | Required | Description                                                                                      |
| ---------------------- | --------- | -------- | ------------------------------------------------------------------------------------------------ |
| `flowId`               | `string`  | ❌        | Session flow ID; injected by the orchestrator.                                                   |
| `url`                  | `string`  | ❌        | Pre-computed redirect URL. When omitted, the module fetches one from the backend.                |
| `disableSmsOption`     | `boolean` | ❌        | Hide the SMS-link option (QR only).                                                              |
| `addContinueToDesktop` | `boolean` | ❌        | Show a "Continue on desktop" affordance for users who'd rather not switch.                       |
| `qrPhishingResistance` | `boolean` | ❌        | Enable the QR anti-phishing handshake (rotates `urlUuid` on mount; validates on the mobile leg). |
| `authHint`             | `string`  | ❌        | QR/auth hint for the mobile leg.                                                                 |
| `externalId`           | `string`  | ❌        | Forwarded to the new mobile session.                                                             |
| `lang`                 | `string`  | ❌        | Forwarded language code.                                                                         |

## State machine

`RedirectToMobileState` is a discriminated union over `status`:

| Status        | Description                                                                        |
| ------------- | ---------------------------------------------------------------------------------- |
| `idle`        | Initial state.                                                                     |
| `loading`     | Fetching the redirect URL (or warming the QR).                                     |
| `redirecting` | QR / SMS option visible; polling onboarding status. User completes flow on mobile. |
| `finished`    | Mobile flow completed (status moved to `ONBOARDING_FINISHED`).                     |
| `closed`      | User dismissed.                                                                    |
| `error`       | Fatal error.                                                                       |

Behind the scenes the module polls onboarding status (`ONBOARDING_NOT_STARTED` → `ONBOARDING_IN_PROGRESS` → `ONBOARDING_FINISHED`) and surfaces only the user-relevant transitions.

## See also

* [Session Management](doc:web-sdk-2-session-api): how the desktop and mobile legs share a session token
* [Module Patterns → composite](doc:web-sdk-2-module-patterns#5-composite--orchestrator-modules)
* [Individual Modules](doc:web-sdk-2-individual-modules)
