Sharepoint托管应用程序提供403 Forbidden Error

时间:2015-05-27 08:10:06

标签: sharepoint sharepoint-apps

我正在开发 sharepoint托管应用,我正在使用angular.js或jquery的rest api。所以我不接受应用列表给出错误 403 Forbidden

休息电话看起来像

$http({
        method: "GET",
        url: appweburl + "/_api/SP.AppContextSite(@target)/web/lists/getbytitle('SurveyManager')/items?@target='" + hostweburl + "'",
        headers: {
            "accept": "application/json;odata=verbose",
            "content-type": "application/json;odata=verbose",
            "X-RequestDigest": angular.element(document.querySelector('#__REQUESTDIGEST')).val()
        }
    });

回复是

{
    "error": {
    "code": "-2147024891, System.UnauthorizedAccessException",
    "message": {
    "lang": "en-US",
    "value": "Access denied. You do not have permission to perform this action or access this resource."
         }
    }
}

1 个答案:

答案 0 :(得分:0)

您需要传递访问令牌来验证请求。