Property 'nonce_supported' does not exist on type 'string | JwtPayload'
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- node.js, typescript
調査の方向性
再現コードの jwt.decode 呼び出しから始め、@types/jsonwebtoken 8.5.8 が payload をどのように型付けしているかを確認します。それをライブラリの 8.5.1 での使用方法と比較します。サンプルの nonce_supported、iss、aud、exp へのアクセスがエラーなしで型チェックを通れば完了です。
索引モデルが issue の本文から書いたものです。
説明
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",
- 主要言語
- JavaScript
- スター
- 18.2k
- フォーク
- 1.3k
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
auth0/node-jsonwebtoken のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
auth0/node-jsonwebtoken#1042 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
auth0/node-jsonwebtoken#1000 · コメント 2 件 · リアクション 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 65/100
auth0/node-jsonwebtoken#1046 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 10/100
auth0/node-jsonwebtoken#1034 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
auth0/node-jsonwebtoken#1032 ·
auth0/node-jsonwebtoken の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
antfu-collective/icones#398 ·
-
ECmail.com オープン
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
wesbos/burner-email-providers#554 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
radiantearth/stac-browser#1023 ·
-
HMR stops working オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
components-web-app/docs#92 ·