Prerequisites
- You need to have the Dynamic SDK initialized with
DynamicContextProvider. - You need to have device registration enabled in your environment’s settings in the Dynamic Dashboard.
- React SDK v5 or later.
Using our UI
Device registration is handled automatically by the SDK. When a user signs in from an unrecognized device, the SDK displays a security prompt with the user’s email, asking them to verify the device. Once the user clicks the verification link in their email, the SDK detects the redirect, completes registration, and dismisses the prompt automatically. No additional code is needed — just enable device registration in your dashboard.Using your UI
To build a custom device registration experience, disable the built-in modal:Checking if device registration is required
UseuseDynamicClient to get the client instance, then listen for user changes with onEvent to check if the current device needs registration.
Handling device registration completion
The SDK handles the email redirect and device registration completion automatically, even when the built-in modal is disabled. You can listen for completion to update your UI:onEvent from the client SDK:
Getting registered devices
Retrieve all trusted devices for the current user. You can useparseUserAgent to display a friendly device name from the raw user agent string.
Each device includes:
| Field | Type | Description |
|---|---|---|
id | string | The device registration ID |
createdAt | string | ISO date of when the device was registered |
userAgent | string | The browser or device user agent |
isCurrentDevice | boolean | Whether this is the device making the request |
Revoking a device
Remove a single trusted device. If the revoked device is the current device, the user will be logged out.Revoking all devices
Remove all trusted devices for the current user. This always logs the user out.Related
- Device Registration Overview — How device registration works and why it matters
- JavaScript SDK Device Registration — Headless integration without React
- Security Overview — Dynamic’s security posture