QR Code Verification

📌 Overview

QR Code verification is a secure and user-friendly method to activate or authenticate a user without manually entering an OTP. The QR code typically contains an OTP and its associated verification key in JSON format.


📩 QR Code Delivery

  • A QR code is sent to the user's email address as part of activation or OTP verification.
  • This QR code contains an encrypted payload with the OTP details.

🧾 QR Code Format (Scanned Content)

Below is the format of code received in the user’s registered email id:

The scanned QR code contains the following JSON:

{
  "value": "dtm88k",
  "key": "jg9ksj",
  "expiry": "2021-03-10T12:26:04IST",
  "userId": "prit1"
}

🔍 Field Descriptions

FieldDescription
valueThe OTP or activation code value
keyVerification key tied to this code, must match SDK's verificationKey
expiryExpiration time of this QR code
userIdThe user ID this QR code belongs to

🔄 Workflow

  1. The SDK triggers a challenge like getActivationCode or getEmailOTP.
  2. Your app displays a QR scanner UI to the user.
  3. User scans the QR code from email.
  4. The app extracts the value and key from the QR code JSON.
  5. It compares the key with verificationKey received from the SDK.
  6. If they match, the app calls the corresponding API:
  • setActivationCode(value) – for activation flows
  • setEmailOTP(value) – for email-based OTP verification

🎯 Matching Keys

  • Match verificationKey from SDK payload with key from QR JSON.
  • Only submit the value if the keys match.

⚠️ Error Scenarios

Error CodeMeaning
4Invalid arguments (malformed input)
17Service not supported
52Failed to open HTTP connection
108Invalid TOTP credential

Ensure QR code hasn’t expired and hasn’t been modified.


🧠 Best Practices

  • Always check QR code expiry before using.
  • Provide fallback option to manually enter OTP.
  • Validate that scanned key matches SDK-provided verificationKey.