Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Node-Express-Angular,为什么不加载JSs?_Javascript_Angularjs_Node.js_Express_Oauth 2.0 - Fatal编程技术网

Javascript Node-Express-Angular,为什么不加载JSs?

Javascript Node-Express-Angular,为什么不加载JSs?,javascript,angularjs,node.js,express,oauth-2.0,Javascript,Angularjs,Node.js,Express,Oauth 2.0,我成功地与那些家伙建立了一个协议栈。它是一种与Oracle数据库交互的表单 现在,我正在添加身份验证,使用nodejs的“client-OAuth2”模块将其请求到OAuth2服务器。这是Node.js中的代码: requireLogin = function (req, res, next) { var uri=ServAuth.code.getUri(); res.redirect(uri); }; app.get('/auth/callback', function (r

我成功地与那些家伙建立了一个协议栈。它是一种与Oracle数据库交互的表单

现在,我正在添加身份验证,使用nodejs的“client-OAuth2”模块将其请求到OAuth2服务器。这是Node.js中的代码:

requireLogin = function (req, res, next) {
    var uri=ServAuth.code.getUri();
    res.redirect(uri);
};

app.get('/auth/callback', function (req, res) {
        ServAuth.code.getToken(req.url)
        .then(function (user) {
                console.log(user); //=> { accessToken: '...', tokenType: 'bearer', ... }
                user.request({
                    method: 'get',
                    url: 'https://aut.server.blabla.bla/api/Me'
                }).then(function (res) {
                    res.body.forEach(function (item){
                        if (item.Type=="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name") {
                                logged_user=item.Value;
                        }
                    });
                  })
                  return res.sendFile(path.resolve(__dirname + '/../public/form.html')); // load the single view file (angular will handle the page changes on the front-end)
        });
});


app.use('/form', requireLogin);
如果我调用“myserver.bla/form”,我将正确地重定向到OAuth2服务器的登录页面;然后我登录并授予访问权限。 然后加载页面“form.html”,但我在浏览器控制台中看到错误:

错误:[$injector:modulerr]未能实例化模块NSW_PCB_QC,原因是: [$injector:nomod]模块“NSW\U PCB\U QC”不可用

请注意,NSW_PCB_QC是角度应用程序的名称(ng app=“NSW_PCB_QC”)

但是如果我直接加载form.html,绕过身份验证,调用“myserver.bla/form.html”,那么所有的模块都正确加载了

问题在哪里


提前感谢

问题在于js脚本中的相对路径指向不同的位置,这取决于文件的服务方式。修复方法是在路径前面添加一个
/
,使路径看起来像

应该像


您能展示form.html的内容吗?嗨@ruedamanuel,谢谢您的关注。html是320行。您认为哪一部分会有帮助?我想看看您正在加载的js脚本的路径,因为html中的相对路径可能引用了/form-route场景中不存在的内容,因为可能缺少静态文件位置声明(只是一个理论)ok,以下是声明:尝试在每个路径之前添加/。我的猜测是,在你描述的两种情景中,它们的根源并不相同。