【问题标题】:Is it possible to use CORS or JSONP with the marketo rest api是否可以将 CORS 或 JSONP 与 marketo rest api 一起使用
【发布时间】:2015-12-28 09:58:31
【问题描述】:

我试图绕过 sop 从 marketo api 获取潜在客户详细信息。 是否可以使用 CORS 或 JSONP。 似乎没有,但我担心我的代码中可能存在错误。

我使用的是《Third Party Javascript》一书中的CORS方法大纲

function createCORSRequest(method, url){
  var xhr = new XMLHttpRequest();
  if ("withCredentials" in xhr){
      console.log('We have credentials');
      xhr.open(method, url, false);
  } else if (typeof XDomainRequest != "undefined"){
      xhr = new XDomainRequest();
      xhr.open(method, url, false);
      console.log('Domain request is undefined');
  } else {
      xhr = null;
      console.log('null null null');    
  }

  return xhr;
};

xhr = new createCORSRequest();
xhr.open("GET", {url}, false);
xhr.send();

目前我遇到了标准的肥皂错误。

我是否只需要在接收文档的域上创建一个新的 api。实际上是 Marketo rest api 的包装器。

【问题讨论】:

    标签: cors jsonp marketo


    【解决方案1】:

    我是否只需要在接收文档的域上创建一个新的 api。实际上是 Marketo rest api 的包装器。

    这确实是最好的方法。您可能可以使用某种方法来规避它,但从安全角度来看,暴露您的访问令牌确实是个坏消息。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-02
      • 2011-02-16
      • 1970-01-01
      • 2011-06-13
      • 2015-12-20
      • 1970-01-01
      相关资源
      最近更新 更多