如何使用Angularjs在Phonegap中验证和访问sharepoint online rest API

时间:2015-10-16 07:30:15

标签: angularjs cordova sharepoint ionic

我提到了这个链接

Visit: http://www.elylucas.net/post/authenticating-with-sharepoint-online-in-a-ionicangularphonegap-app/ Authenticate Sharepoint API

从上面的链接我使用此功能并获得安全令牌成功但我无法获得Set-Cookie标头响应我必须将此cookie发送到每个sharepoint api请求以获得api响应成功但我正在努力解决这个问题。 请帮帮我。

function getBearerToken(result, url) {

    var deferred = $q.defer();

    var securityToken = $($.parseXML(result)).find("BinarySecurityToken").text();

    if (securityToken.length == 0) {
        deferred.reject();
    }
    else {
        $http({
            method: 'POST',
            url: url,
            data: securityToken,
            headers: {
                Accept: "application/json;odata=verbose"
            }
        }).success(function (data) {
            deferred.resolve(data);
        }).error(function () {
            deferred.reject();
        });
    }

    return deferred.promise;
}

});

0 个答案:

没有答案