Error: misconfigured csrf - Express JS 4

前端 未结 2 1477
庸人自扰
庸人自扰 2021-01-11 10:45

I am trying to enable the csrf module of Express 4 in an existing application.

I have added the following code:

var csrf = require(\'csurf\')
...

ap         


        
2条回答
  •  佛祖请我去吃肉
    2021-01-11 11:32

    I have found the solution. The call to app.use(csrf()) must be set after app.use(cookieParser()) AND app.use(session({...}).

提交回复
热议问题