Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/438.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/21.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 passport.authenticate()未通过$http.get执行_Javascript_Angularjs - Fatal编程技术网

Javascript passport.authenticate()未通过$http.get执行

Javascript passport.authenticate()未通过$http.get执行,javascript,angularjs,Javascript,Angularjs,我有下面的角度控制器 angular.module('app').controller('mvNavBarLoginCtrl', function($scope, $http){ $scope.login = function(){ $http.get('/auth/twitter').then(function(response){ if(response.data.success) { a

我有下面的角度控制器

angular.module('app').controller('mvNavBarLoginCtrl', function($scope, $http){
    $scope.login = function(){
        $http.get('/auth/twitter').then(function(response){
            if(response.data.success)
            {
                alert(response);
            }
        });
    }
});
My
routes.js
具有以下功能:

app.get('/auth/twitter', passport.authenticate('twitter'));
我可以验证我是否到了这里,但是似乎没有执行passport.authenticate

如果我尝试使用
(href=“/auth/twitter”target=“\u self”)
从html标记中点击相同的路径,则更多信息


知道我错过了什么吗

只需查看代码而不检查passport api。我想是护照。验证返回302重定向为响应。302重定向的主体为空。您的回调函数将不会跟随302。在链接中执行此操作时,浏览器会按照302执行。

听起来您是正确的。是angular拦截重定向而不是让浏览器处理重定向直到完成吗?浏览器应该处理302,但是…你知道这样的事情可能会发生。仔细查看devtool网络选项卡,查看您收到的响应/标题。