angularjs - 使用 Yeoman 的 Angular-Fullstack 在 postman 中发帖时出现 403

标签 angularjs mongodb yeoman angular-fullstack

我正在尝试在我的 Yeoman Angular-fullstack 应用程序中使用 MongoDB 填充本地数据库。我使用了端点命令:

yo angular-fullstack:endpoint [options] <name>

并且可以到达路由,但它是一个空对象。它不允许我发帖。

我收到错误: 连接 403 错误:缺少 CSRF token

Mongod 运行良好。

页面上有认证,但此时没有禁止路由。

谢谢你的帮助。

最佳答案

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

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
    }));
  }

关于angularjs - 使用 Yeoman 的 Angular-Fullstack 在 postman 中发帖时出现 403,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35145063/

相关文章:

javascript - 带有静态链接选项的 ng-option

javascript - html5 电话链接在 iOS 上触发了两次

node.js - 如何使用 Mailgun 和 Node.js 将图像作为附件发送?

javascript - 提交 POST AngularJS 后表单未清除

sass - 自耕农角度 : Sass compilation extremly slow

javascript - Angular UI路由器初始化

javascript - 如何将 Controller 的范围属性传递给自定义指令?

sql - 如何将此 mongo 查询移植到 postgres?

javascript - Mongodb $setOnInsert 不适用于 $max 和 $min

angularjs - “yeoman”不被识别为内部或外部命令、可操作程序或批处理文件