【问题标题】:Satellizer error卫星发射器错误
【发布时间】:2017-08-28 21:18:00
【问题描述】:
angular.module('starter')

   .controller('LoginCtrl', function($scope, $location, $stateParams, $ionicHistory, $http, $state, $auth, $rootScope) {

    $scope.loginForm = {}
    $scope.loginError = false;
    $scope.loginErrorText;

    $scope.login = function() {

        var credentials = {
            email: $scope.loginForm.email,
            password: $scope.loginForm.password
        }

        console.log(credentials);

        $auth.login(credentials).then(function() {
             console.log('im in login function' );
            // Return an $http request for the authenticated user
            $http.get('http://localhost:8000/api/v1/auth/user').success(function(response){
                // Stringify the retured data
                var user = JSON.stringify(response.user);

                // Set the stringified user data into local storage
                localStorage.setItem('user', user);

                // Getting current user data from local storage
                $rootScope.currentUser = response.user;
                // $rootScope.currentUser = localStorage.setItem('user');;

                $ionicHistory.nextViewOptions({
                  disableBack: true
                });

                $state.go('app.jokes');
            })
            .error(function(){
                $scope.loginError = true;
                $scope.loginErrorText = error.data.error;
                console.log($scope.loginErrorText);
            })
        });
    }
});

当我调用登录函数时,我得到了这个错误

POST http://localhost:8100/auth/login 404(未找到)

卫星发射器有问题吗?

【问题讨论】:

    标签: angularjs satellizer


    【解决方案1】:

    我也遇到了同样的问题。我刚刚加了

    $authProvider.loginUrl = myServer+ 'oauth/token';
    $authProvider.tokenName = 'access_token';
    $authProvider.tokenPrefix = 'myServerAuth';
    $authProvider.tokenHeader = 'Authorization';
    $authProvider.tokenType = 'Bearer';
    

    在我的配置中,它运行良好。

    【讨论】:

      猜你喜欢
      • 2016-07-13
      • 2017-02-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多