我正在开发sharepoint托管应用程序,我正在使用angular.js或jquery的rest api。所以我不接受应用程序列表给出一个错误403 Forbidden
Rest调用看起来像
$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."
}
}
}
您需要传递一个访问令牌来验证请求。