Read the signing key from the environment and name the algorithm #1
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
azer/koa-jwt-example!1
Loading…
Reference in a new issue
No description provided.
Delete branch "azer/jwt-key-and-algorithm"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This repository exists to be copied, so the two things worth getting right are the two that get copied: the signing key was a literal in index.js, and jwt.verify named no algorithm. The key now comes from JWT_SECRET with a fallback called insecure-development-key so the sample still runs out of the box and nobody mistakes the value for one to keep; sign and verify both name HS256. Checked by running it: login returns a token, /protected accepts it, a garbage token and wrong credentials are both 401.