
A QR code displayed on a desktop or kiosk device.
- Registering a mobile device for QR code verification by adding a device credential. This step creates a new public/private key pair.
- Responding to an authentication request by approving or rejecting a device challenge. This step uses the device’s private key to sign a message which is verified on the server using the public key.
Use cases
- Log into a desktop or web application from an application that is typically used on mobile
- Identify a user on a kiosk in a quick service restaurant (QSR) to load loyalty programs, rewards and offers
- Log into an application running on a TV
- Complete a payment via a terminal
Sequence diagram
The general flow for QR code verification is as follows:- Generate a challenge
- Display the QR code to the user
- Wait for the user to scan and respond on their mobile device
- Handle the authentication result (approved/rejected)
Portal setup
Enable the device credential authentication method for your tenant.SDK setup
Server SDK
Initialize the SDK using your secret key from the API keys page and the API URL for your region.Web and Mobile SDKs
The Web SDK is used to initiate the challenge in a browser by generating a QR code. The Mobile SDK is used to respond to the challenge in a mobile app by scanning the QR code. Initialize both SDKs using your tenant ID from the API keys page and your API URL.Enrollment
Scenario - Enroll users for QR code verification in your mobile app so it can be used as a
method for authenticating on another device.
1. Generate enrollment token
In your backend, track an action for a user (e.g. “addAuthenticator”) to generate a short-lived token.2. Add credential
Use the token obtained in step 1 to enroll a new device credential for the user in the mobile app.Authentication
Scenario - Let users scan a QR code with their mobile app to authenticate on another device.
1. Track action (optional)
You may optionally track an action from your backend if you want to create a QR code challenge that can only be completed by a specific user or run rules on the action for adaptive MFA. If you want to start a QR code challenge that can be claimed and completed by any user, skip to step 2. Track an action from your backend using our Server SDK.setToken
method.
When creating a QR code challenge after tracking an action, the custom data and action code must
be provided in the track request and cannot be overridden in the challenge request from the
frontend.
2. Present QR code
Use our Web SDK or Client API to initiate a QR code challenge. Initiate QR code challenge Use theqrCode.challenge()
method to initiate a challenge.
The SDK will handle all the complexity of managing the challenge lifecycle, including automatic refreshing and state updates.
By default the SDK will use WebSocket connections.
If your environment does not support WebSockets, you can fall back to polling using REST API calls by setting polling
to true
.
1
Initial state
After calling
qrCode.challenge()
, the QR code is ready to be scanned. Display it to the user.2
Claimed
When
onStateChange
is called with state: "claimed"
, the user has scanned the QR code. You can
use this state change to indicate progress in your UI.3
Approved
When
onStateChange
is called with state: "approved"
and a token
, the user has approved the
challenge. Pass the token to your backend for validation.4
Rejected
When
onStateChange
is called with state: "rejected"
, the user has declined the challenge. Show an error message and provide a way to retry.qrCode.refresh()
method:
qrCode.challenge()
method has been called. The original callbacks will be used with the new challenge.
3. Scan QR code
Once the user scans the QR code, use the mobile sdkclaimChallenge
method to set the user attempting to complete the challenge.
The claimChallenge
method will return some context about the desktop or kiosk initiating the challenge such as ip address, location, user agent and custom data. This data can be shown to the user to help them decide if they want to approve or decline the challenge.
4. Approve or decline the challenge
Present a dialog to allow the user to review the challenge context and approve or decline the challenge by calling the mobile sdkupdateChallenge
method.
5. Complete authentication
Once the challenge is approved, theonStateChange
callback will return a token
that should be passed to your backend to validate the challenge for the action and complete the authentication flow.
Next steps
- Passkeys - Offer the most secure and user-friendly passwordless authentication