Property 'nonce_supported' does not exist on type 'string | JwtPayload'
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- node.js, typescript
- Domain
- authentication
Research direction
Start with the jwt.decode call in the reproduction and inspect how @types/jsonwebtoken 8.5.8 types its payload; compare that with the library's 8.5.1 usage. Done means the sample's nonce_supported, iss, aud, and exp accesses type-check without errors.
Written by the indexing model from the issue text.
Description
Description
@types/jsonwebtoken 8.5.8 break the nestjs application,
sample code
import * as jwt from 'jsonwebtoken';
// identityToken, nonce are props from apple signin
const decoded = jwt.decode(identityToken, { complete: true });
// ...
if (decoded.payload.nonce_supported && nonce !== NONCE) {
// ...
}
if (!decoded.payload.iss || decoded.payload.iss !== APPLE_BASE_URL) {
// ...
}
if (decoded.payload.aud !== 'my.aud.string') {
// ...
}
if (Number(decoded.payload.exp) * 1000 < my_expr_limit) {
// ...
}
error message:
Property 'nonce_supported' does not exist on type 'string | JwtPayload'.
Property 'nonce_supported' does not exist on type 'string'.
Property 'iss' does not exist on type 'string | JwtPayload'.
Property 'iss' does not exist on type 'string'.
Property 'aud' does not exist on type 'string | JwtPayload'.
Property 'aud' does not exist on type 'string'.
Property 'exp' does not exist on type 'string | JwtPayload'.
Property 'exp' does not exist on type 'string'.
Reproduction
- create a nestjs app
- add
"jsonwebtoken": "^8.5.1",to your package.json - implement apple sign in as the sample above
- npm install
- npm run start then you can see the errors
Environment
Please provide the following:
- Version of this library used: 8.5.1
- Version of the platform or framework used, if applicable: node 16.13.1, npm 8.1.2
- Other relevant versions (language, server software, OS, browser): OS Mac M1
- Other modules/plugins/libraries that might be involved: "@types/jsonwebtoken": "8.5.8",
- 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
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
antfu-collective/icones#398 ·
-
ECmail.com Open
Difficulty 1/5 Under an hour Newbie friendliness 90/100
wesbos/burner-email-providers#554 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
radiantearth/stac-browser#1023 ·
-
HMR stops working Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
components-web-app/docs#92 ·