Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

jwt.verify() returns numeric payload claims as strings

Open Beginner friendly
#1,042 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active

Research direction

Start by running the reported jwt.sign() and jwt.verify() snippet in the repository's existing test setup, then trace the verify() entry point to see how the decoded payload is represented. Confirm whether a numeric id remains a number at runtime and add a regression test covering this behavior; done means the test and the reported example agree on the claim type.

Written by the indexing model from the issue text.

Description

Explanation:
I hope you doing great guys
When I use "verify()" in Typescript it is going to return string for everything even the one was a number in the "sign()" object payload.

Summary of the issue:
When signing a JWT with a numeric id claim, jwt.verify() appears to return the claim as a string instead of a number.

A small copy of my code:
const token = jwt.sign(
{ id: 67 },
secret
);
const decoded = jwt.verify(token, secret) as { id: number };
console.log(typeof decoded.id);
Expected behavior:
number
Actual behavior:
string

I checked the value before calling "jwt.sign()" and was confirmed to be a number .

Environment
Node.js: v20.20.2
Package: [jsonwebtoken, @types/jsonwebtoken]
Package version: [^9.0.3, ^9.0.10]
OS: window 11

I hope you have a great day.

Dominant language
JavaScript
Stars
18.2k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from auth0/node-jsonwebtoken

All issues in auth0/node-jsonwebtoken

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.