JavaScript SDK

Verifications inbox

Show the signed-in user their pending verification requests and let them approve, deny or enter a code.

A verification is an identity check your backend (or a helpdesk agent) sends to a user, for example before a password reset over the phone. scute.verifications lets the signed-in user see and answer them in your app. Calls use the current session's access token.

List#

const { data, error } = await scute.verifications.list({ status: "pending", limit: 10 });// data.verifications: Verification[]
ParamType
status"pending", "verified", "failed", "expired", "cancelled" or "denied"
pagenumber
limitnumber

listAll(params) lists every verification of the app (GET /v1/verify/:app_id/verifications/app). getById(id) returns { verification }.

A Verification has id, verification_id, status, channel, verification_type, reason, intent, intent_fields, identifier, metadata, recipient ({ id, name, email, phone }), purpose, challenge_method ("email_otp", "sms_otp", "magic_link", "totp", "webauthn", "push"), token, created_at, expires_at, completed_at, verified_at, remaining_attempts and max_attempts.

Answer#

await scute.verifications.approve(id);await scute.verifications.deny(id, "I did not ask for this");await scute.verifications.verifyCode(id, "123456");
MethodDoes
approve(id)Approves a pending verification. Returns { verification }.
deny(id, reason?)Denies it.
verifyCode(id, code)Checks a code against it.
resend(id)Creates a fresh challenge with the same parameters.
cancel(id)Cancels it.

Watch for new ones#

const stop = scute.verifications.onNew((verification) => {  showToast(`${verification.intent}: approve or deny`);}, 3000);stop(); // or scute.verifications.stopPolling()

onNew(callback, intervalMs = 3000) polls the pending list and calls you once per verification it has not seen. The polling stops when the last subscriber unsubscribes.