JWT验证失败 [英] JWT Authentication Failed
问题描述
每次登录用户后,当我尝试通过后端推文来测试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屋!