Skip to content

Commit

Permalink
docs(jwt-helper): add exp to jwt sign example (honojs#276)
Browse files Browse the repository at this point in the history
  • Loading branch information
amiftachulh authored Mar 26, 2024
1 parent 46564b2 commit efc91d7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion helpers/jwt.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ 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)
Expand All @@ -43,7 +44,7 @@ const token = await sign(payload, secret)
### Options

- `payload`: unknown - required
- The JWT payload to be signed.
- The JWT payload to be signed. You can include other claims like in [Payload Validation](#payload-validation).
- `secret`: string - required
- The secret key used for JWT verification or signing.
- `alg`: [AlgorithmTypes](#supported-algorithmtypes)
Expand Down

0 comments on commit efc91d7

Please sign in to comment.