Javascript Sharepoint Office365 REST API在浏览器中不工作
我正在尝试从我们的Office365 Sharepoint网站(上)读取数据 (ourserver.sharepoint.com)并在我正在开发的客户站点中使用它,该站点当前正在本地主机上运行 我已从与Sharepoint的成功连接中提取了X-RequestDigest标头(使用Postman模拟我想要进行的调用) 我试图在HTML应用程序中运行的Javascript代码中包含的REST API调用如下所示:Javascript Sharepoint Office365 REST API在浏览器中不工作,javascript,office365,sharepoint-online,sharepoint-rest-api,Javascript,Office365,Sharepoint Online,Sharepoint Rest Api,我正在尝试从我们的Office365 Sharepoint网站(上)读取数据 (ourserver.sharepoint.com)并在我正在开发的客户站点中使用它,该站点当前正在本地主机上运行 我已从与Sharepoint的成功连接中提取了X-RequestDigest标头(使用Postman模拟我想要进行的调用) 我试图在HTML应用程序中运行的Javascript代码中包含的REST API调用如下所示: $mightymouse.api.xhr("/_api/Lists/getbytitl
$mightymouse.api.xhr("/_api/Lists/getbytitle('Event')/items", {
type: "GET",
dataType: "json",
headers: {
"accept": "application/json;odata=verbose",
"X-RequestDigest": "0x7D5..."
},
xhrFields: {
"withCredentials": false
},
crossDomain: true}).then( function okCallback(response)...
我在Chrome开发者工具中看到的请求响应是HTTP状态代码403和以下响应:
{“error”:{“code”:“-2147024891,System.UnauthorizedAccessException”,“message”:{“lang”:“en-US”,“value”:“访问被拒绝。您没有执行此操作或访问此资源的权限。”}}
我试着用Python模拟调用,不同的是我可以用Python发送cookie,而用Javascript无法发送cookie,特别是FedAuth
和rtFa