Skip to content

Login with WebAuthn Hosted

Overview

WebAuthn Hosted login provides secured, WebAuthn-based biometric authentication and a fully hosted authentication experience. It can be used to authenticate user login, or create new users based on their email address. For information on supported WebAuthn mobile and desktop platforms, see Hosted WebAuthn platform support.

Here's how it works:

  1. User clicks login button, sending request to /v1/auth/webauthn with client_id and redirect_uri
  2. Mosaic redirects to the login page, which authenticates user and redirects back to Mosaic.
  3. After validating the response, Mosaic redirects back to your redirect_uri with a code.
  4. Your application sends the code to your backend, which exchanges it for tokens via /oidc/token.
  5. Upon a successful exchange, the user is logged in.

Step 1: Configure WebAuthn

To customize the authentication experience, you can configure WebAuthn Hosted authentication from the Mosaic Admin Portal. However, no setup is required to start using this authentication method.

From B2B or B2C Identity (based on your setup) > Experience management > select your app > WebAuthn and configure the authentication experience you want to provide (e.g., branding).

Step 2: Add redirect URI to app

To redirect back to the redirect_uri provided in the initial request, it should be registered in your application settings in the Mosaic Admin Portal. From the Admin Portal under Applications, click on your application to edit your application settings and add this URI under Redirect URIs. If you don't already have an application, you'll need to create one first (see Create application).

Note

Your application settings contain the Client ID and Client Secret for your application, which you'll need for Step 4 and 5.

Step 3: Initiate login

Use a request like the one below to initiate an authentication flow using WebAuthn Hosted login, described in the sequence diagram above. The create_new_user parameter will determine if this flow applies to new users, or only to existing ones. If set to true (and public sign-ups are enabled for this application), a new user is created if no user is found for the email returned by Mosaic in the next step. The redirect_uri should correspond to the one added in step 3, and the client_id can be found from the Mosaic Admin Portal in the application settings.

Note

Upon successful authentication, the browser will be redirected to the redirect URI along with a code to exchange for tokens in the next step. For example, if https://domain.com/verify is your redirect URI, then Mosaic will redirect to https://domain.com/verify?code=123abc. However, if an authentication error occurs after redirecting to WebAuthn Hosted, the redirect URI will contain the error instead.

curl --request GET \
     --url 'https://api.transmitsecurity.io/cis/v1/auth/webauthn?
     client_id=2eb840f.test.Transmit.io&
     redirect_uri=https://www.example.com/login&
     create_new_user=true' \
     --header 'Accept: application/json'

Step 4: Get user tokens

To exchange the code received from Mosaic for an ID and access token, your server should send a POST request like the one below to the Mosaic /oidc/token endpoint. Replace placeholders with the code you received in Step 3, your redirect URI, and your client credentials that can be found in your application settings from the Mosaic Admin Portal.

curl -i -X POST \
  https://api.transmitsecurity.io/oidc/token \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d client_id=CLIENT_ID \
  -d client_secret=CLIENT_SECRET \
  -d code=CODE \
  -d grant_type=authorization_code \
  -d redirect_uri=REDIRECT_URI

What's next?

From B2B or B2C Identity (based on your setup) > Experience management > select your app > WebAuthn, you can customize the branding and authentication logic of your hosted experience.

For how to customize the branding using custom CSS, click here.

Platform support

Supported desktop platforms

WebAuthn hosted is supported on the following desktop platforms:

PlatformMin OS VersionBrowserMin Browser VersionFIDO2 Support
Windows 7SP1Chrome95Yes
Windows 7SP1Microsoft Edge95Yes
Windows 7SP1Opera78Yes
Windows 7SP1Firefox93Yes
Windows 1020H2Chrome95Yes
Windows 1020H2Microsoft Edge95Yes
Windows 1020H2Opera78Yes
Windows 1020H2Firefox93Yes
macOS10.15Safari14.5Yes
macOS10.15Chrome95Yes
macOS10.15Microsoft Edge95Yes
macOS10.15Opera75No
macOS10.15Firefox38No
Note

Users who attempt to authenticate from other browsers are requested to switch to a supported browser.

Supported mobile platforms

WebAuthn hosted is supported on the following mobile platforms:

PlatformMin OS VersionBrowserMin Browser VersionFIDO2 Support
Android9Chrome95Yes
Android9Microsoft Edge95Yes
Android9Firefox93Yes
Android9Opera63.3.3216.58675Yes
Android9Opera GX1.4.9No
Android9Samsung Browser17.0Yes
Android9UC BrowserAll versionsNo
iOS14.5Safari14.5Yes
iOS14.5Chrome95Yes
iOS14.5Microsoft Edge95Yes
iOS14.5Firefox38Yes
iOS14.5Opera3.1.0Yes
Note

Opera GX and UC browsers do not support the FIDO2 WebAuthN protocol. If biometric authentication is required, users are requested to switch to a supported browser. If biometric authentication is not required, users are authenticated using the fallback method configured in the Admin Portal.