【问题标题】:Fullcalendar EventSource URL not authenticated - AngularjsFullcalendar EventSource URL 未经过身份验证 - Angularjs
【发布时间】:2016-11-17 17:14:45
【问题描述】:

我在我的应用程序中向 Fullcalendar 添加了一个事件源。以下是相同的代码。

$scope.eventSources = [{
    url: URL,
    type: 'POST',
    data: {
        'id': id
    }
}];

虽然我对服务器的所有请求都经过身份验证,但通过事件源的请求在身份验证中失败。如果我在服务器中禁用身份验证,EventSource 将按预期工作。这个问题有什么原因吗?

我有一个通过 PassportJs 完成身份验证的 Node JS 服务器。我使用 req.isAuthenticated() 函数来验证对服务器的所有请求是否都经过身份验证。

【问题讨论】:

    标签: angularjs node.js http authentication fullcalendar


    【解决方案1】:

    我尝试通过一个函数获取事件,它成功了。下面是代码。

    events: function(start, end, timezone, callback) {
        $http({
            method: 'POST',
            url: URL,
            data: {
                'id': id,
                'start': start,
                'end': end
            }
            }).then(function successCallback(response) {
                //success code
            }, function errorCallback(response) {
                //error handler
            });
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-09-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-11-15
      • 2016-01-17
      相关资源
      最近更新 更多