1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

jsonwebtokenの返り値がundefined

Posted at

問題

ライブラリjsonwebtoken を用いてトークンのデコードを行なっているが返り値が何も返ってこない。

token-verify.js

const token= 'ey....'

jwt.verify(token, pem, { algorithms: ['RS256'] }, function(err:{}, decoded:{}) {
    decodedToken = decoded
    console.log(decodedToken)
});



% node token-verify.js
undefined


解決策

定数で設定したトークンを更新する。
期限が古い、トークンの署名が不正などあればundefinedが返される模様。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?