The Webauthn module is a part of a client-side JavaScript SDK. It allows you to easily log in users with biometrics based on the WebAuthn APIs. The SDK does all the heavy lifting to provide secure WebAuthn authentication while leaving you the flexibility to control the authentication logic and user experience.
The SDK offers many advantages over the APIs, including:
- Journey orchestration to support decisions and complex flows
- Client-side WebAuthn calls, along with data processing before and after
- Simplifies calls to Mosaic, reducing unnecessary complexity
Load the SDK:
npm install @transmitsecurity/platform-web-sdk@^2To initialize, use the following code:
// Import WebAuthn module
import { webauthn, initialize } from '@transmitsecurity/platform-web-sdk';
// Initialize SDK
// If SDK was loaded via script tag, use window.tsPlatform.initialize({ ... })
webauthn.initialize({
clientId: 'your-client-id',
webauthn: {
serverPath: 'https://api.transmitsecurity.io' // Required: Set serverPath based on your region or custom domain
}
});If you're using a custom domain for your application, replace the default Transmit domain (api.transmitsecurity.io) with your custom domain in serverPath (for example, https://your-domain.com instead of https://api.transmitsecurity.io).
Customizations:
| Name | Type | Description |
|---|---|---|
serverPath | string | (Required) The WebAuthn module should be configured to work with your region or custom domain by setting serverPath to:- https://api.transmitsecurity.io (for US) - https://api.eu.transmitsecurity.io (for EU) - https://api.ca.transmitsecurity.io (for Canada) - https://api.au.transmitsecurity.io (for Australia) - https://api.sbx.transmitsecurity.io (for sandbox) - https://<your_custom_domain> (for custom domain) For the SDK modules to work properly together, the regions must match. |
webauthnApiPaths? | WebauthnApis | Override endpoints when using a proxy server in case the proxy server implements its own paths. |
For more information, refer to the class reference, as well as the Quick start guide.