Yammer REST API CORS

依然范特西╮ 提交于 2019-12-13 04:18:01

问题


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.

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


回答1:


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




回答2:


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.




回答3:


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.



来源:https://stackoverflow.com/questions/24884267/yammer-rest-api-cors

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!