Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/367.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Sharepoint Office365 REST API在浏览器中不工作_Javascript_Office365_Sharepoint Online_Sharepoint Rest Api - Fatal编程技术网

Javascript Sharepoint Office365 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

我正在尝试从我们的Office365 Sharepoint网站(上)读取数据 (ourserver.sharepoint.com)并在我正在开发的客户站点中使用它,该站点当前正在本地主机上运行

我已从与Sharepoint的成功连接中提取了X-RequestDigest标头(使用Postman模拟我想要进行的调用)

我试图在HTML应用程序中运行的Javascript代码中包含的REST API调用如下所示:

$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