sign token is not equal with https://jwt.io/
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 30/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript, node.js
- Domain
- authentication, backend, security
Research direction
Start with the inline crypto.generateKeyPairSync, jwt.sign, and jwt.verify reproduction; no repository file or test is named. Compare the two tokens and their decoded payloads, then trace the signing and verification inputs. The issue is resolved when the reported difference is explained and the expected behavior is covered by a reproducible test.
Written by the indexing model from the issue text.
Description
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmqThNdOtauJpQ8jmaSfM
gx4RCw/E1dX27/h25P3CSsVRVXITEiPKgyk7ZW/WNp97gc2wGch28FJTK+ULZk9D
G4Y2xzUcy666FwDkii8JAQa56jSppt3G9OPfp5iaYnynVpHHWyvNqTi9hfwtShsW
ObirZfjFVc25A+RwuBcOgHvNus6EEm13nldbL/dWqY+dWG0Us/jOoSZuAiaLAxwM
eJcwHM1rJj+6eUc8Bj41+U1Hdizn+U67BrolVnCtaWpnzGHyYDJlMakyJfoDqYEB
1bgWLcYuShvv//k2gdN+KMRueOfVFhbUiCG1eZy14FIvgJQt/0K4zYmfLF5YjUr4
SQIDAQAB
-----END PUBLIC KEY-----
-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCapOE1061q4mlD
yOZpJ8yDHhELD8TV1fbv+Hbk/cJKxVFVchMSI8qDKTtlb9Y2n3uBzbAZyHbwUlMr
5QtmT0MbhjbHNRzLrroXAOSKLwkBBrnqNKmm3cb049+nmJpifKdWkcdbK82pOL2F
/C1KGxY5uKtl+MVVzbkD5HC4Fw6Ae826zoQSbXeeV1sv91apj51YbRSz+M6hJm4C
JosDHAx4lzAczWsmP7p5RzwGPjX5TUd2LOf5TrsGuiVWcK1pamfMYfJgMmUxqTIl
+gOpgQ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mnlGEIUnqruMEVpTv5A9NQkvPMZgSVu9G
R9AMtOJfTiduquGA0Yn+OYyLENNIG+p8EUfmrrkCgYEAtPmui7iRncnJTjPQwGxO
lqWGpz3XJmLmucGoxEu4JJY7K5pH9sJxS/9dpTO8p+4pcDf5RiW2VllAnIn3ulbl
QIMmNvn/tcRiQbpFhOFXSbCDoV9KfxBMaX0UZJDYYc/VC5J6z9pMV+vhwFsNeypd
RQ8Ih8JV4T3Rae0dKlnhQtg=
-----END PRIVATE KEY-----
const payload = { sub: 'user123', role: 'admin' };
const token = jwt.sign(payload, privateKey, { algorithm: 'RS256' });
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyMTIzIiwicm9sZSI6ImFkbWluIiwiaWF0IjoxNjg4MTAxNzI4fQ.D3Pio6RmSnGsP3vhz50aJX8XPB5tRA4EdO8k2gTzpzh9gBms-8TJhTM0uez4THzUgT3PDjAYsQ0i-HGrRf74AcwMmm1Bc0zGwr3_MYNgx3fW7X12P-9ow9BzEF9bDH07cXulMqK2RDa-lvbD6ngGP926KKF9Jse9MIo3jGZ5377Ro0MpbB6bYktjDdo-y_U8oqsICdDO7YeVVshDwuxKboFGZAsbV1sYO1XU-15DfhkA0yF5i_lk6dhqsCco0KpIpmNQHAzWZCYSMZZ5DPd6kY9v7MCUDGfKcK_Gnx_KPo92_0k7IRMMNytZrhBsm0jasGIkE3XrLIsmo9588mvUbg
https://jwt.io/ token
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyMTIzIiwicm9sZSI6ImFkbWluIiwiaWF0IjoxNjg4MTAxMzAwfQ.K7SToDIrmsAoXTny08R5HQPvkFTOZUVpudXzNuqk8L_JnBSVVlMys4cypK1CngUDiyZhrPwmqJEOcfOUlTEmWM1jorjgwz6KjleRcVzvEnSnzWOG2Gvh7LPm0taT8glSLtwXdSDYCMREwZgv2aVlberbZ8Br08SitxLp47askktIPlOz4IbvoixcUhrhCN2WpZGefcC5QaDQKjR2ca6ptjaAe3l-YRwCecqMSHqkeCHC2xQaoi2DXjS3ed5dDXF0sydql-Z9U9xv_2jO634jzEg4XFEVbKPmgvqZneCr6m5b44CQapxdv4RgIaHHtlunaqRCroKLV0zIx2UpK5Gd6Q
const crypto = require('crypto');
const jwt = require('jsonwebtoken');
const { privateKey, publicKey } = crypto.generateKeyPairSync('rsa', {
modulusLength: 2048,
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem'
},
publicKeyEncoding: {
type: 'spki',
format: 'pem'
},
});
const payload = { sub: 'user123', role: 'admin' };
const token = jwt.sign(payload, privateKey, { algorithm: 'RS256' });
console.log("token=", token);
jwt.verify(token, publicKey, function (err, user) {
console.log("=====")
console.log(err)
console.log(user) // user info from the token
console.log("=====")
});
- Dominant language
- JavaScript
- Stars
- 18.2k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from auth0/node-jsonwebtoken
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
auth0/node-jsonwebtoken#1042 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
auth0/node-jsonwebtoken#1000 · 2 comments · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 65/100
auth0/node-jsonwebtoken#1046 ·
-
Difficulty 5/5 Over a week Newbie friendliness 10/100
auth0/node-jsonwebtoken#1034 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
auth0/node-jsonwebtoken#1032 ·
All issues in auth0/node-jsonwebtoken
Similar issues
-
Bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Automattic/safe-publish#594 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
dream-num/dsh-univer-office#104 ·
-
comp/dashboard invalid P3
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
NousResearch/hermes-agent#121143 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
avniproject/avni-webapp#1811 ·
-
area/auroraboot area/webui bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100