Skip to main content

TOTP Authentication in KaneAI

Introduction

Teams often need to test SSO or MFA‑protected applications where the second factor is a six‑digit OTP. Native TOTP support in KaneAI generates those codes on the fly from the shared secret key, keeps the entire login journey inside KaneAI with identical behavior in Replay, generated code, and CI, and lets you inject the code directly into your test steps—no external scripts or servers required.

How it works

  1. Register the TOTP secret once during authoring via Secret Key.
  2. At runtime KaneAI calculates the correct Time-based OTP code every 30 seconds.
  3. You can reference the TOPT code as a smart variable inside any test step, assertion, or API call.
Add TOTP secret key

Prerequisites

  • A TOTP‑compatible login flow (e.g., Google Authenticator, Okta Verify, Microsoft Authenticator).
  • The secret key (base32 encoded) associated with the account you want KaneAI to log in as.

Step‑by‑step Guide

Add a TOTP Secret Key

  1. Start a web authoring session from here and press /.
  2. Choose Add TOTP Authentication Key.
  3. Enter the Base32 secret directly or user LambdaTest Secrets using {{ syntax.
  4. Click Save.
  5. A smart variable gets generated which provides the 6-digit code based on above secret key when invoked.
Add TOTP secret modal

Insert the TOTP into your test

  1. Navigate to the OTP input field in your application.
  2. Use the smart variable generated to add your instruction such as "Enter {{totp}} in verify field"
  3. KaneAI fetches and inserts the 6-digit code.
Insert OTP variable

Video Explanation

FAQ

Does KaneAI store my secret securely?

Yes. Secrets are encrypted, stored in Vault and never exposed in logs or generated code.

Do mobile tests support TOTP?

Yes. The smart variable generated via secret key {{totp}} is available in both Web and Mobile test steps.

Test across 3000+ combinations of browsers, real devices & OS.

Book Demo

Help and Support

Related Articles