Skip to main content
The Authsignal Web SDK can be used to:
  • Launch the pre-built UI to let users set up MFA and complete challenges
  • Sign up and sign in users using passkeys or security keys
  • Build custom UIs for authenticating with email OTP, SMS OTP, WhatsApp OTP, authenticator app, push, or QR code

GitHub repository

Installation

npm install @authsignal/browser
This will add our module to your package.json.

Initialization

Initialize the client with your tenant ID and the API URL for your region.
import { Authsignal } from "@authsignal/browser";

const authsignal = new Authsignal({
  tenantId: "YOUR_TENANT_ID",
  baseUrl: "YOUR_REGION_BASE_URL",
});
You can find your tenantId in the Authsignal Portal. You must specify the correct baseUrl for your tenant’s region.
RegionAPI URL
US (Oregon)https://api.authsignal.com/v1
AU (Sydney)https://au.api.authsignal.com/v1
EU (Ireland)https://eu.api.authsignal.com/v1
CA (Montreal)https://ca.api.authsignal.com/v1

Parameters

tenantId
string
required
Your Authsignal tenant ID, found in the Authsignal Portal.
baseUrl
string
The API URL for your tenant’s region. See the region table above.
onTokenExpired
function
A callback invoked when the current token expires. Use it to prompt the user to re-authenticate or to fetch a fresh token.
The name of the cookie used to persist the anonymous device ID. Defaults to __as_aid.
The domain used when setting the anonymous device ID cookie. Defaults to the current location.hostname.
enableLogging
boolean
Whether to log SDK warnings and errors to the console. Defaults to false.

Usage

Passkeys

Security keys

Email OTP

Email magic link

SMS OTP

WhatsApp OTP

Authenticator app

Push verification

QR code verification

Launching the pre-built UI