【发布时间】:2016-03-17 11:27:43
【问题描述】:
我是 gulp 的新手,我正在为我的应用程序使用 gelp 服务器,我在端口 8080 上有一个 java 服务器,我想在另一个项目中使用 oAuth2 进行身份验证,我使用 grunt 以及我如何将用户重定向到 oAuth2
这里是我的 gruntfile 代码
connect: {
options: {
port: 9000,
// Change this to '0.0.0.0' to access the server from outside.
hostname: 'localhost',
livereload: 35729
}, proxies: [
{
context: [
'/_ah',
'/secured',
'/oauth2login',
'/oauth2callback'
],
host: 'localhost',
port: 8080,
https: false,
changeOrigin: false,
xforward: false
}
]
}
现在我想在我的 gulpfile.js 代码中对 gulp 做同样的事情
var options = {
port: 3000,
ghostMode: {
clicks: false,
location: false,
forms: false,
scroll: true
},
injectChanges: true,
logFileChanges: true,
logLevel: 'debug',
logPrefix: 'gulp-patterns',
notify: true,
reloadDelay: 0, //1000,
online: false,
proxies: [
{
context: [
'/_ah',
'/secured',
'/oauth2login',
'/oauth2callback'
],
host: 'localhost',
port: 8080,
https: false,
changeOrigin: false,
xforward: false
}
]
};
我添加了代理但没有工作我想这样做,因为在我的 app.run 中我想使用 oAuth2 验证用户
这里是我的 app.run
app.run(function($rootScope, datastoreUser){
datastoreUser.LoginUser("me").then(function(result){
console.log("User is authenticated");
console.log(result);
},function(error){
console.log("An error occured user is not authenticated");
console.log(error);
window.location.href = '/oauth2login';
})
})
【问题讨论】:
标签: java angularjs gruntjs gulp