---
title: "Require a recent sign-in"
description: "Ask the person to confirm it's them before a sensitive action: which actions ask, the dialog that asks, and recentSignIn on your own functions."
canonical_url: "https://nuxt-backend.dev/docs/build/auth/access/step-up"
---
# Require a recent sign-in

> Ask the person to confirm it's them before a sensitive action: which actions ask, the dialog that asks, and recentSignIn on your own functions.

Version: nuxt-backend 0.6.x · Tab: Build · Kind: how-to · 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.

- [Try it live in the playground](https://nuxt-backend.dev/playground/security)
- [API reference](https://nuxt-backend.dev/docs/reference/api/use-reauthentication)
- [Source](https://github.com/qruto/nuxt-backend/blob/main/src/convex/sensitive-actions.ts)

A session can outlive the person who opened it: a laptop left open, a cookie copied off a machine. Most of what an account does is fine for such a session. A few actions are not, so they take a **recent sign-in**, one from the last ten minutes. Saving or removing a passkey takes one. So do deleting the account, inviting people to a workspace or changing who belongs to it, and an administrator's writes. An older session is refused with [`reauthentication_required`](https://nuxt-backend.dev/docs/reference/backend/errors#reauthentication_required). The person confirms it's them with a passkey or a code, and the action runs again.

Better Auth's own `session.freshAge` covers its passkey routes. The package extends the same window to every sensitive route and function, and adds the dialog that asks.

## How it works

- **Every session knows when its sign-in happened.** The session token carries the time, which no field of your user table can write.
- **One window.** A sensitive action compares that time with ten minutes, `RECENT_SIGN_IN_SECONDS` (600) from `nuxt-backend/functions`. Better Auth's `session.freshAge` is set to the same value, so its own checks agree.
- **Confirming is an ordinary sign-in.** It is held to the account it replaces: another account's passkey is refused (`forbidden`, reason `other_account`). The new session keeps the active workspace, and the old one is signed out. The client waits for the live connection to take the new token, so the retried action carries it.
- **It fails closed.** An administrator's visit to the account never passes (`forbidden`, reason `impersonating`): the administrator can't sign in as the person. A session that carries no sign-in time is refused as `reauthentication_required`.

Signing devices out never asks. Revoking a session is how a person defends an account they fear for, and it must work the first time.

## Which actions ask

The sensitive-action table, `SENSITIVE_ACTIONS` from `nuxt-backend/functions`, names every auth route and every public function the scaffold ships. For each it says how recent a sign-in it takes, whether an administrator's visit may run it, and the limits it spends. The tables below are generated from the code, so they list the routes the code guards today, those of features left for a later release included.

<table>
<thead>
  <tr>
    <th>
      Auth route
    </th>
    
    <th>
      Recent sign-in
    </th>
    
    <th>
      Impersonated session
    </th>
    
    <th>
      Limits
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        /email-otp/send-verification-otp
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      <code>
        emailOtp
      </code>
      
       (address), <code>
        emailOtpGlobal
      </code>
      
       (global)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /sign-in/email-otp
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      <code>
        emailOtpAttempt
      </code>
      
       (address)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /email-otp/verify-email
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      <code>
        emailOtpAttempt
      </code>
      
       (address)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /passkey/generate-authenticate-options
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      <code>
        passkeySignIn
      </code>
      
       (client), <code>
        passkeySignInGlobal
      </code>
      
       (global)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /passkey/verify-authentication
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /sign-in/recovery-code
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      <code>
        passkeySignIn
      </code>
      
       (client), <code>
        passkeySignInGlobal
      </code>
      
       (global)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /email-otp/request-password-reset
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      <code>
        emailOtp
      </code>
      
       (address), <code>
        emailOtpGlobal
      </code>
      
       (global)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /forget-password/email-otp
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      <code>
        emailOtp
      </code>
      
       (address), <code>
        emailOtpGlobal
      </code>
      
       (global)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /email-otp/reset-password
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      <code>
        emailOtpAttempt
      </code>
      
       (address)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /sign-in/email
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /sign-up/email
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /request-password-reset
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /reset-password
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /change-password
      </code>
    </td>
    
    <td>
      10 min
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /verify-password
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /email-otp/check-verification-otp
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /send-verification-email
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /change-email
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /sign-in/social
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /callback/:id
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /link-social
      </code>
    </td>
    
    <td>
      10 min
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /unlink-account
      </code>
    </td>
    
    <td>
      10 min
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /get-access-token
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /refresh-token
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /list-sessions
      </code>
    </td>
    
    <td>
      10 min
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /update-session
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /revoke-session
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /revoke-sessions
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /revoke-other-sessions
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /email-otp/request-email-change
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      <code>
        emailChange
      </code>
      
       (caller), <code>
        emailOtpAttempt
      </code>
      
       (address), <code>
        emailOtpGlobal
      </code>
      
       (global)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /email-otp/change-email
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      <code>
        emailOtpAttempt
      </code>
      
       (address)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /delete-user
      </code>
    </td>
    
    <td>
      10 min
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      <code>
        accountDelete
      </code>
      
       (caller)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /delete-user/callback
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /passkey/generate-register-options
      </code>
    </td>
    
    <td>
      10 min
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /passkey/verify-registration
      </code>
    </td>
    
    <td>
      10 min
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /passkey/delete-passkey
      </code>
    </td>
    
    <td>
      10 min
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /passkey/update-passkey
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /passkey-only/set
      </code>
    </td>
    
    <td>
      10 min
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /two-factor/enable
      </code>
    </td>
    
    <td>
      10 min
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /two-factor/disable
      </code>
    </td>
    
    <td>
      10 min
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /two-factor/get-totp-uri
      </code>
    </td>
    
    <td>
      10 min
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /two-factor/generate-backup-codes
      </code>
    </td>
    
    <td>
      10 min
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /two-factor/verify-totp
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      <code>
        emailOtpAttempt
      </code>
      
       (address)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /two-factor/verify-backup-code
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      <code>
        emailOtpAttempt
      </code>
      
       (address)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /two-factor/send-otp
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /two-factor/verify-otp
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      <code>
        emailOtpAttempt
      </code>
      
       (address)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /organization/create
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      allowed
    </td>
    
    <td>
      <code>
        workspaceCreate
      </code>
      
       (caller)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /organization/accept-invitation
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /organization/leave
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /organization/invite-member
      </code>
    </td>
    
    <td>
      10 min
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      <code>
        invitation
      </code>
      
       (caller), <code>
        invitationGlobal
      </code>
      
       (global)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /organization/remove-member
      </code>
    </td>
    
    <td>
      10 min
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /organization/update-member-role
      </code>
    </td>
    
    <td>
      10 min
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /organization/delete
      </code>
    </td>
    
    <td>
      10 min
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /admin/list-users
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      <code>
        admin
      </code>
      
       (caller)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /admin/get-user
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      <code>
        admin
      </code>
      
       (caller)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /admin/list-user-sessions
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      <code>
        admin
      </code>
      
       (caller)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /admin/revoke-user-session
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      <code>
        admin
      </code>
      
       (caller)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /admin/revoke-user-sessions
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      <code>
        admin
      </code>
      
       (caller)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /admin/create-user
      </code>
    </td>
    
    <td>
      10 min
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      <code>
        admin
      </code>
      
       (caller)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /admin/update-user
      </code>
    </td>
    
    <td>
      10 min
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      <code>
        admin
      </code>
      
       (caller)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /admin/set-role
      </code>
    </td>
    
    <td>
      10 min
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      <code>
        admin
      </code>
      
       (caller)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /admin/ban-user
      </code>
    </td>
    
    <td>
      10 min
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      <code>
        admin
      </code>
      
       (caller)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /admin/unban-user
      </code>
    </td>
    
    <td>
      10 min
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      <code>
        admin
      </code>
      
       (caller)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /admin/impersonate-user
      </code>
    </td>
    
    <td>
      10 min
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      <code>
        admin
      </code>
      
       (caller)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /admin/set-user-password
      </code>
    </td>
    
    <td>
      10 min
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      <code>
        admin
      </code>
      
       (caller)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /admin/remove-user
      </code>
    </td>
    
    <td>
      10 min
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      <code>
        admin
      </code>
      
       (caller)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        /admin/disable-passkey-only
      </code>
    </td>
    
    <td>
      10 min
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      <code>
        admin
      </code>
      
       (caller)
    </td>
  </tr>
</tbody>
</table>

<table>
<thead>
  <tr>
    <th>
      Scaffold function
    </th>
    
    <th>
      Recent sign-in
    </th>
    
    <th>
      Impersonated session
    </th>
    
    <th>
      Limits
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        account:exportAccountData
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        account:grantConsent
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        account:withdrawConsent
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        account:chooseStorage
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        account:completeOnboarding
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        audit:dismissActivation
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        audit:recordSource
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        auth:revokeSession
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        notifications:markNotificationsRead
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        notifications:setNotificationChannel
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        notifications:subscribePush
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        notifications:unsubscribePush
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        ai:transform
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      <code>
        ai
      </code>
      
       (entity)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        billing:syncEntitlements
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      allowed
    </td>
    
    <td>
      <code>
        billingSync
      </code>
      
       (entity)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        billing:getRevenue
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        billing:generateCheckoutLink
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        billing:giftCheckout
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        billing:generateCustomerPortalUrl
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        billing:claimGift
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        billing:resendGift
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        billing:changeGiftRecipient
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        billing:rescheduleGift
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        billing:cancelGift
      </code>
    </td>
    
    <td>
      10 min
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        billing:updateSubscription
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        billing:cancelSubscription
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        billing:acceptSaveOffer
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        billing:withdraw
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        billing:uncancelSubscription
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        billing:cancelPendingChange
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        billing:pauseSubscription
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        billing:resumeSubscription
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        billing:refundOrder
      </code>
    </td>
    
    <td>
      10 min
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        flags:setFlag
      </code>
    </td>
    
    <td>
      10 min
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        email:setEmailTopic
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        email:unsubscribeAllTopics
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        email:recordTimeZone
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        email:dismissAnnouncement
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        email:publishAnnouncement
      </code>
    </td>
    
    <td>
      10 min
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        email:endAnnouncement
      </code>
    </td>
    
    <td>
      10 min
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        email:previewAnnouncement
      </code>
    </td>
    
    <td>
      10 min
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        email:sendAnnouncement
      </code>
    </td>
    
    <td>
      10 min
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        email:cancelAnnouncement
      </code>
    </td>
    
    <td>
      10 min
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        email:liftSuppression
      </code>
    </td>
    
    <td>
      10 min
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        webhooks:replayWebhookDelivery
      </code>
    </td>
    
    <td>
      10 min
    </td>
    
    <td>
      refused
    </td>
    
    <td>
      
    </td>
  </tr>
</tbody>
</table>

## Ask in the UI

`useReauthentication().withReauthentication(action)` runs the action. When the server refuses it as `reauthentication_required`, it opens `<ReauthenticateDialog>`, waits for the person to confirm, and runs the action once more. A cancelled dialog rejects with the first refusal, so the error your page shows says why nothing happened.

```vue [app/pages/team.vue]
<script setup lang="ts">
const { members, removeMember } = useWorkspace()
const { withReauthentication } = useReauthentication()

async function remove(memberId: string) {
  await withReauthentication(() => removeMember(memberId))
}
</script>

<template>
  <ul>
    <li v-for="member in members" :key="member.id">
      {{ member.user.name }}
      <button type="button" @click="remove(member.id)">Remove {{ member.user.name }}</button>
    </li>
  </ul>
</template>
```

`<SecuritySettings>`, `<AccountData>` and the admin console already do this, and render the dialog themselves. For your own pages, mount the dialog once in your layout. Of every dialog on a page, only the oldest opens:

```vue [app/app.vue]
<template>
  <NuxtLayout>
    <NuxtPage />
  </NuxtLayout>
  <ReauthenticateDialog />
</template>
```

The dialog offers the passkey first, and a code to the account's own address beside it. The code request passes the [bot check](https://nuxt-backend.dev/docs/build/auth/sign-in/bots) like the sign-in form's. Its words are the `reauthenticate` label group.

To build your own dialog, call `useReauthentication({ prompt: true })` in the component that renders it. It returns `isRequired`, `step` (`choose`, then `verify-code`), `email`, `otp`, `isPending`, `error`, and the step actions `withPasskey`, `sendCode`, `verifyCode`, `back` and `cancel`, which never reject. With no prompt on the page, `withReauthentication` rejects with the refusal as it came, and a development build warns that the dialog is missing.

## Ask in your own functions

A function built from the [tiers](https://nuxt-backend.dev/docs/build/auth/access/functions) declares it beside `args`: `recentSignIn: true` for ten minutes, or a number of seconds. The `admin` tier's mutations and actions ask by default, and a routine one says `recentSignIn: false`:

```ts [backend/strips.ts]
import { admin, workspace } from './functions'

export const archiveAll = workspace.mutation({
  recentSignIn: true,
  args: {},
  handler: async (ctx) => {
    const strips = await ctx.db.query('strips')
      .withIndex('workspaceId', q => q.eq('workspaceId', ctx.workspace.id))
      .take(500)
    for (const strip of strips) await ctx.db.patch('strips', strip._id, { archived: true })
  },
})

export const reindex = admin.action({
  recentSignIn: false, // an admin write, but a routine one
  args: {},
  handler: async () => {},
})
```

Only a mutation or an action asks. A query is not rerun as time passes, so its window would not hold, and defining one with `recentSignIn` throws. Ask in the mutation or action the sensitive step runs in.

A function checks the recent sign-in last, after roles and membership. Someone who may not act at all is told so, and never asked to sign in again first.

## In tests

`asUser(t, { signedInAt })` from `nuxt-backend/test` opens the session at that time, so a test can call as a sign-in older than the window:

```ts [backend/strips.test.ts]
const stale = await asUser(t, { signedInAt: Date.now() - 11 * 60_000 })
await expect(stale.mutation(api.strips.archiveAll, {})).rejects.toThrow()
```

By default, every caller signed in a moment ago.

## Related

- [Protect backend functions](https://nuxt-backend.dev/docs/build/auth/access/functions): the tiers `recentSignIn` sits beside.
- [Manage passkeys and sessions](https://nuxt-backend.dev/docs/build/auth/accounts/security): `<SecuritySettings>`, which asks on its own.
- [Errors](https://nuxt-backend.dev/docs/reference/backend/errors#reauthentication_required): `reauthentication_required` and the `other_account` reason.
- [Security model](https://nuxt-backend.dev/docs/ship/security): what the server holds a re-authentication to.


## Sitemap

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