我正在尝试在我的 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/