/Knowledge/sources/honojs__hono/llms-full/jwt-authentication-helper-sign-example--8c8fa0534212.md
JWT Authentication Helper: sign() > Example - hono-docs
JWT Authentication Helper: sign() Example Source evidence: /Sources/honojs hono/provenance.md Canonical citation: https://hono.dev/llms full.txt example Summ...
JWT Authentication Helper: sign() > Example
Source evidence: /Sources/honojs__hono/provenance.md Canonical citation: https://hono.dev/llms-full.txt#example
Summary
ts import { sign } from 'hono/jwt' const payload = { sub: 'user123', role: 'admin', exp: Math.floor(Date.now() / 1000) + 60 * 5, // Token expires in 5 minutes } const secret = 'mySecretKey' const token = await sign(payload, secret)
Content
import { sign } from 'hono/jwt'
const payload = {
sub: 'user123',
role: 'admin',
exp: Math.floor(Date.now() / 1000) + 60 * 5, // Token expires in 5 minutes
}
const secret = 'mySecretKey'
const token = await sign(payload, secret)
Metadata
{
"chunk_index": 0,
"citation": "https://hono.dev/llms-full.txt#example",
"coverage_role": "overview",
"qualified_title": "Hono / llms-full / JWT Authentication Helper > `sign()` > Example",
"retrieved_at": "2026-07-02T05:51:01Z",
"section_index": 635,
"source_id": "/honojs/hono",
"source_type": "llms_full",
"target_label": "llms-full",
"title": "JWT Authentication Helper: sign() > Example",
"upstream_url": "https://hono.dev/llms-full.txt",
"version": "2026"
}