Facebook JS SDK CORS problems -


i'm working facebook js sdk "go live dialog" live streaming, every thing works fine until last step when want publish stream , can't publish because there cors error, is:

xmlhttprequest cannot load https://graph2.facebook.com/v2.5/10154376393778843?access_token=eaaoapyi8mx....&suppress_http_code=1. response preflight request doesn't pass access control check: 'access-control-allow-origin' header contains multiple values '*, https://www.facebook.com/', 1 allowed. origin 'https://www.facebook.com/' therefore not allowed access.

the issue due graph2.facebook.com sending cors header twice:

access-control-allow-origin: *

access-control-allow-origin: https://facebook.com/

and google chrome accepts one.

i opened bug on facebook until answers "disable cors security" on browsers, a bad solution if want make app public every one.

the code app this:

<script> window.fbasyncinit = function() { fb.init({   appid      : '452751035113070',   xfbml      : true,   version    : 'v2.8' }); };  (function(d, s, id){  var js, fjs = d.getelementsbytagname(s)[0];  if (d.getelementbyid(id)) {return;}  js = d.createelement(s); js.id = id;  js.src = "//connect.facebook.net/en_us/sdk.js";  fjs.parentnode.insertbefore(js, fjs);  }(document, 'script', 'facebook-jssdk'));  </script>  <button id="livebutton">create live stream facebook</button>  <script>   document.getelementbyid('livebutton').onclick = function() {  fb.ui({  display: 'popup',  method: 'live_broadcast',  phase: 'create',  }, function(response) {  if (!response.id) {   alert('dialog canceled');   return;  }  console.log('stream url:' + response.secure_stream_url);  fb.ui({   display: 'popup',   method: 'live_broadcast',   phase: 'publish',   broadcast_data: response,  }, function(response) {  console.log("video status: \n" + response.status);  });  });  };  </script> 

also here here: https://plnkr.co/edit/aq0hkcth5suxfol6qkun?p=preview . make real try should start streaming using wowza or similar, if not, publish button disabled , problem occurs when click publish button.

did know how handle allow users use script , force them use other browsers or disable security options? or need wait until facebook fix it?

i disable chrome extension , works.

the extension is: jetbrains ide support 2.0.9

this strange because every post talk can't have 2 cors directives , think server keeps sending 2 directives or maybe server send 1 , extensions modify headers...i don't know, ir works.


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -