---
title: "useHumanCheck"
description: "useHumanCheck, auto-imported in the app: its options, return value and types."
canonical_url: "https://nuxt-backend.dev/docs/reference/api/use-human-check"
---
# useHumanCheck

Version: nuxt-backend 0.6.x · Tab: Reference · Kind: reference · Status: stable

Every page: [llms.txt](https://nuxt-backend.dev/llms.txt) · Skill for coding agents: [nuxt-backend](https://nuxt-backend.dev/.well-known/skills/nuxt-backend/SKILL.md)

Commands use npm; use your project's package manager.

## Interfaces

### UseHumanCheckReturn

Defined in: [src/runtime/vue/composables/use-human-check.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-human-check.ts)

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="mode">
        
      </a>
      
       <code>
        mode
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<a href="#humancheckmode">
        <code>
          HumanCheckMode
        </code>
      </a>
      
      >
    </td>
    
    <td>
      How this browser proves it is a person: <code>
        challenge
      </code>
      
       (a widget that asks for a click only when it must, wherever the app has a site key; on Vercel BotID checks too), <code>
        detection
      </code>
      
       (BotID's invisible check alone, on Vercel), or <code>
        off
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-human-check.ts" rel="nofollow">
        src/runtime/vue/composables/use-human-check.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="ispending">
        
      </a>
      
       <code>
        isPending
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      <code>
        true
      </code>
      
       while a token is on its way.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-human-check.ts" rel="nofollow">
        src/runtime/vue/composables/use-human-check.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="error">
        
      </a>
      
       <code>
        error
      </code>
    </td>
    
    <td>
      <code>
        Ref
      </code>
      
      < | <a href="https://nuxt-backend.dev/docs/reference/api/functions#backenderror">
        <code>
          BackendError
        </code>
      </a>
      
       | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      Why the last token was refused (<code>
        forbidden
      </code>
      
      , reason <code>
        bot_check
      </code>
      
      ), or <code>
        null
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-human-check.ts" rel="nofollow">
        src/runtime/vue/composables/use-human-check.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="token">
        
      </a>
      
       <code>
        token
      </code>
    </td>
    
    <td>
      (<code>
        action
      </code>
      
      , <code>
        subject?
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      A token for one call of <code>
        action
      </code>
      
       (up to 32 letters, digits, <code>
        _
      </code>
      
       and <code>
        -
      </code>
      
      ), for <code>
        verifyHuman(ctx, token, { action, subject })
      </code>
      
       on the deployment: a proof the app's server signs once its bot check passed (on Vercel), bound to <code>
        subject
      </code>
      
       when one is named (the address a waitlist join gives, say: up to 320 characters, read without case), or else to this browser (an HttpOnly visitor cookie the route sets, which <code>
        jobs.enqueue
      </code>
      
       counts a signed-out visitor's guest jobs by), or a challenge answer. Resolves <code>
        null
      </code>
      
       when the app checks nobody: the deployment then takes the call without one. Rejects when the check fails.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-human-check.ts" rel="nofollow">
        src/runtime/vue/composables/use-human-check.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

## Type Aliases

### HumanCheckMode

```ts
type HumanCheckMode = "detection" | "challenge" | "off";
```

Defined in: [src/runtime/vue/protection/state.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/protection/state.ts)

How this browser proves it is a person: a challenge, BotID's invisible check alone, or neither (`off`).

## Functions

### useHumanCheck()

```ts
function useHumanCheck(): UseHumanCheckReturn;
```

Defined in: [src/runtime/vue/composables/use-human-check.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-human-check.ts)

Proof that a person makes a call: the client half of `verifyHuman`, for
the calls that reach the deployment over the live connection and never
pass through the app's server (a waitlist join, a contact form, a
referral claim). Ask for a token right before the call, pass it along,
and let the function check it, in an action: a challenge answer is
verified with the provider, which only an action can call. A token is
good for one action, and a proof for a minute.

The sign-in code request needs none of this: the auth client answers the
check on its own.

#### Returns

[`UseHumanCheckReturn`](#usehumancheckreturn)

#### Example

```vue
<script setup lang="ts">
import { api } from '#backend/api'

const join = useAction(api.waitlist.join)
const { token, error } = useHumanCheck()

async function submit(email: string) {
  await join({ email, human: await token('waitlist', email) })
}
</script>
```


## Sitemap

See the full [sitemap](https://nuxt-backend.dev/sitemap.md) for all pages.
