Error: algorithms should be set

使用 jwt 报错:algorithms should be set:

导致报错的语句(node_modules\_express-jwt@6.0.0@express-jwt\lib\index.js:22):

if (!options.algorithms) throw new Error('algorithms should be set')



原因是:

2020.7.7日jwt更新之后,安装的express-jwt模块会默认为6.0.0版本,更新后的jwt需要在配置中加入algorithms属性,即设置jwt的算法。一般HS256为配置algorithms的默认值:

 

posted @ 2022-02-09 18:50  塞纳纽斯  阅读(131)  评论(0)    收藏  举报