# auth.token.verify

Checks a JWT against a jwt_signing_key credential

# auth.token.verify

```
auth.token.verify --credential TEXT --from TEXT [--issuer TEXT] [--audience TEXT] → token
```

Checks a JWT against a `jwt_signing_key` credential. It checks the JWT in `--from` — a password-reset or e-mail-confirmation link (`$trigger.query.token`), a token posted by another system (`$trigger.body.token`) — against a `jwt_signing_key` credential. Adds `token: { valid, claims }` on the `valid` pin, or `token: { valid: false, reason }` on `invalid`, and keeps the rest of the payload. The algorithm comes from the credential, never from the token's header, so `alg: none` is refused; a token without `exp` is invalid. To protect a route with the session cookie or a bearer header do not use this: put `--auth jwt --credential <id>` on the trigger and read `$trigger.auth`.

## Flags

- `--credential` (required): The jwt_signing_key credential that signed it.
- `--from` (required): The token to check — usually {{ $trigger.query.token }} or {{ $trigger.body.token }}.
- `--issuer`: Require this iss claim.
- `--audience`: Require this aud claim.

## Examples

### Confirm an e-mail link

```
| auth.token.verify --credential jwt_main --from "{{ $trigger.query.token }}" --audience email-confirm
```

`valid` → mark the user confirmed by `input.token.claims.sub`; `invalid` → a page saying the link expired.

It answers:

```json
{
  "token": {
    "valid": true,
    "claims": {
      "sub": "u_1",
      "aud": "email-confirm",
      "exp": 1789000000
    }
  }
}
```
