403使用Yeoman的Angular-Fullstack在邮递员中发帖

Tes*_*ien 4 mongodb angularjs yeoman angular-fullstack

我试图在我的Yeoman Angular-fullstack应用程序中使用MongoDB填充本地数据库.我使用了endpoint命令:

yo angular-fullstack:endpoint [options] <name>
Run Code Online (Sandbox Code Playgroud)

并且可以到达路线,但它是一个空的物体.它不允许我发布.

我收到错误: 连接403错误:CSRF令牌丢失

Mongod运行正常.

页面上有身份验证,但此时没有禁止的路由.

谢谢你的帮助.

小智 11

转到.\ server\config\express.js并将xssProtection更改为false或向if语句添加'development'!== env:

if ('test' !== env && 'development' !== env) { // <- add development env here
    console.log("using lusca");

    app.use(lusca({
      csrf: {
        angular: true
      },
      xframe: 'SAMEORIGIN',
      hsts: {
        maxAge: 31536000, //1 year, in seconds
        includeSubDomains: true,
        preload: true
      },
      xssProtection: true // <- or change this to false
    }));
  }
Run Code Online (Sandbox Code Playgroud)