JWT验证失败 [英] JWT Authentication Failed

查看:68
本文介绍了JWT验证失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次登录用户后,当我尝试通过后端推文来测试API上的文本时,都会向我抛出与您看到的相同的错误.它在curl代码段中显示了我想要的输出,但是在主体中引发了错误.这是我的仓库GitHub-naima-shk/Twitter-Clone

Every time when I try to test the text on API in terms of backend tweets after login the user it throws me the same error as you see. It's showing my desired output in a curl Code snippet but throwing an error in a body. Here is my repo GitHub - naima-shk/Twitter-Clone

TypeError:无法读取未定义的属性文本"

TypeError: Cannot read property 'text' of undefined

1 :

推荐答案

遇到此问题的原因是因为您不小心误写了password.js文件第1行中的策略.

The reason why you're experiencing this issue is because you accidentally misspelled strategy in line 1 of your passport.js file.

也与您的问题无关,但是您不再需要使用bodyparser,而只需使用

Also unrelated to your problem, but you no longer need to use bodyparser, instead you can simply use

app.use(express.json())

这篇关于JWT验证失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆