Skip to main content
This recipe shows how to verify a user’s credential inside your application using the AIR Kit SDK. After verification, you can gate access to features, content, or services based on the result.

What you’ll build

  1. A verification program configured for your app.
  2. SDK code that prompts the user to present a credential.
  3. Application logic that reacts to the verification result.

Prerequisites

Step 1: Create a verification program

  1. Go to the Developer Dashboard.
  2. Navigate to Verifier > Programs.
  3. Create a new verification program, selecting the credential schema you want to verify against.
  4. Note the Verification Program ID.

Step 2: Authenticate the user

The user must have an active session before verification. Use the AIR Kit login flow:
const airService = new AirService();
await airService.init({ partnerId: "your-partner-id" });
const loginResult = await airService.login();

Step 3: Request credential verification

Call verifyCredentials with your Verifier DID and the verification program ID:
const verificationResult = await airService.verifyCredentials({
  verifierDid: "did:air:id:test:YOUR_VERIFIER_DID",
  verificationId: "YOUR_VERIFICATION_PROGRAM_ID",
});

if (verificationResult.verified) {
  console.log("Credential verified:", verificationResult);
  grantAccess();
} else {
  console.log("Verification failed or was declined");
  denyAccess();
}
The SDK opens a built-in UI asking the user to select and present a matching credential. Zero-knowledge proofs are used — the verifier confirms the claim without seeing the raw data.

Step 4: Gate features based on the result

function grantAccess() {
  // User has a valid credential — show premium content, unlock tier benefits, etc.
}

function denyAccess() {
  // No valid credential — redirect to onboarding or show a restricted view
}

Auth token for server-side verification

If you need to verify from your backend instead, generate a Partner JWT with scope: "verify":
const payload = {
  partnerId: "your-partner-id",
  scope: "verify",
  exp: Math.floor(Date.now() / 1000) + 5 * 60,
};
See Partner Authentication for full JWT setup.

Next steps