Yammer REST API CORS[英] Yammer REST API CORS

本文是小编为大家收集整理的关于Yammer REST API CORS的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

我已经在Yammer设置了一个应用程序,并添加了JavaScript起源,但仍然无法制作XHR请求

XMLHttpRequest cannot load https://www.yammer.com/platform/login_status.json?client_id=123456789&_=123456789. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://example.com.dev:9000' is therefore not allowed access.

 yammer javascript ordient

有什么建议吗? 我正在本地机器上工作,并拥有示例com.dev作为localhost解决.

推荐答案

我认为答案是在域名中.

使用 api .ymerm.com代替www.yammer.com

有关类似问题,请参见Marco 在这里

其他推荐答案

没有'访问控制 - 允许孔素'标题 资源.

您可以做2件事:

  • 请Yammer.com允许您的来源或使用非浏览器HTTP请求,例如curl.
  • 如果您开发了已经允许的原点,则应在开发机上重写主机文件和Web服务器配置,以将允许的原点绑定到DEV站点.当前这不是一个选项,因为没有根据错误消息发送任何允许的原始标头.

这就是您所能做的.

其他推荐答案

除了将URL更改为 api.yammer.com 确保您不包括任何额外的标题.

例如,我偶然地包括一个额外的标头'X-foo-id',那是绊倒Yammer.

本文地址:https://www.itbaoku.cn/post/1937744.html

问题描述

I've setup an app in Yammer and added Javascript origins but still can't make xhr request

XMLHttpRequest cannot load https://www.yammer.com/platform/login_status.json?client_id=123456789&_=123456789. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://example.com.dev:9000' is therefore not allowed access.

Yammer Javascript origin setup

Any suggestion? I'm working from a local machine and having example.com.dev to resolve as localhost.

推荐答案

I think the answer is in the domain name.

Use api.yammer.com instead of www.yammer.com

See for similar problem also the answer from Marco here

其他推荐答案

No 'Access-Control-Allow-Origin' header is present on the requested resource.

You can do 2 things:

  • Ask yammer.com to allow your origin, or use a non browser HTTP request, for example with cURL.
  • If you develop an origin which is already allowed, then you should rewrite the hosts file and the webserver configuration on your dev machine, to bind the allowed origin to your dev site. Currently this is not an option, because there isn't any allow origin header sent according to the error message.

That's all you can do.

其他推荐答案

In addition to changing the URL to be api.yammer.com be sure that you're not including any extra headers.

For example, I was accidentally including an extra header 'X-Foo-Id' and that was tripping up Yammer.