Satellizer:Facebook身份验证弹出AngularJS后出现404错误

时间:2015-09-03 07:26:04

标签: angularjs facebook satellizer

我有一个控制器可以处理我的Angular应用程序的身份验证。

'use strict';

/**
  * Controller used for authentications
  */

angular.module('myAPP').controller('SignInUpController', function ($scope, $location, $auth) {
    $scope.testVariable = 'Testa;dffdjklkjlakl;dklskf';

    $scope.message = 'FAILED';

    $scope.authenticate = function(provider) {
     $auth.authenticate(provider).then(function() {
       $location.path('/signinup');
       $scope.message = 'SUCCESS';
     }).catch(function(response) {
       $scope.message = response.data.message;
     });
    };

});

目前,我只是想让登录功能正常运行。它似乎工作。我的HTML上有一个触发此按钮的按钮。它工作正常。出现Facebook弹出窗口,并请求许可。返回时会出现问题。我收到以下错误。

angular.js:10661 POST http://localhost:9000/auth/facebook 404 (Not Found
(anonymous function) @ angular.js:10661
sendReq @ angular.js:10480
serverRequest @ angular.js:10187
processQueue @ angular.js:14634
(anonymous function) @ angular.js:14650
Scope.$eval @ angular.js:15878
Scope.$digest @ angular.js:15689
Scope.$apply @ angular.js:15986
tick @ angular.js:11231

我的所有Satellizer配置都是默认配置。

facebook: {
          name: 'facebook',
          url: '/auth/facebook',
          authorizationEndpoint: 'https://www.facebook.com/v2.3/dialog/oauth',
          redirectUri: (window.location.origin || window.location.protocol + '//' + window.location.host) + '/',
          requiredUrlParams: ['display', 'scope'],
          scope: ['email'],
          scopeDelimiter: ',',
          display: 'popup',
          type: '2.0',
          popupOptions: { width: 580, height: 400 }
 }

从这段代码中可以看出它应该被点击了。但我不确定为什么它不起作用。

这与ui-router有什么关系吗?我想也许这与它为什么不起作用有关。

我是Satellizer的新手。 如果我有一个复杂的简单问题,请提前抱歉。

1 个答案:

答案 0 :(得分:0)

您必须实现服务器端组件来处理/auth/facebook POST端点并返回有效的JWT。

有一些示例可以在卫星项目的examples目录中实现此功能。

相关问题