Web services 使用sharepoint跨域javascript库从localhost使用REST API

Web services 使用sharepoint跨域javascript库从localhost使用REST API,web-services,rest,sharepoint,sharepoint-2013,Web Services,Rest,Sharepoint,Sharepoint 2013,我尝试从部署在localhost中的应用程序中使用sharepoint rest API。sharepoint网站位于sharepoint 2013 online中 为此,我使用javascrpt跨域库。我这里有一个例子 我的应用程序是一个完全静态的网站,我没有VS,所以我试图找出外接程序的授权。我进入我网站的\u layouts/15/appinv.aspx页面,授权第三方应用程序: 应用程序域:localhost:8080 重定向url:(无意义?) 权限请求XML: 当我转到我的应用程

我尝试从部署在localhost中的应用程序中使用sharepoint rest API。sharepoint网站位于sharepoint 2013 online中

为此,我使用javascrpt跨域库。我这里有一个例子

我的应用程序是一个完全静态的网站,我没有VS,所以我试图找出外接程序的授权。我进入我网站的
\u layouts/15/appinv.aspx
页面,授权第三方应用程序:

  • 应用程序域:localhost:8080
  • 重定向url:(无意义?)
  • 权限请求XML:
当我转到我的应用程序时,我用我的帐户进行身份验证:cookie中填充了
FedAuth
rtFa

我认为现在使用API就足够了:

var executor = new SP.RequestExecutor(addinweburl);

executor.executeAsync(
    {
        url:
            addinweburl + "/_api/web/GetFolderByServerRelativeUrl('Shared%20Documents')"
        ,
        method: "GET",
        headers: { "Accept": "application/json; odata=verbose" },
        success: function(e) {
            alert('success');
        },
        error: function(e, c, d) {
            alert('fail');
        }
    }
);
调用错误处理程序并发送1007错误代码。这很奇怪,因为这段代码是在大小太重要时使用的


感谢您的帮助

如果应用程序未部署在同一sharepoint网站域上,则无法使用库

我回退到OAuth协议以验证我的客户机。
以下文档是理解如何获取访问令牌的关键:

Hi,我正在尝试从独立于SharePoint的web应用程序中实现类似的功能。我设法加载了SP.RequestExecutor.js。基本上,我需要从部署在不同域中的第三方web应用程序创建一个SP站点,这根本不是SharePoint。请你给我引路好吗?谢谢你的帮助