I'm using the Facebook Graph API to upload a video to a Page. The process involves three steps as described in the official documentation: https://developers.facebook.com/docs/video-api/guides/publishing/
I'm currently stuck on Step 2: Start the upload.
My problem is when I test the request using Postman, everything works fine. But when I try the same request using JavaScript fetch in the browser, I get a CORS error:
Cross-origin request blocked: The Same Origin directive
Here is my code:
fetch('https://graph.facebook.com/v23.0/upload:<UPLOAD_SESSION_ID>?sig=...', {
method: 'POST',
headers: {
'Authorization': 'OAuth <ACCESS_TOKEN>',
'file_offset': '0',
'Content-Type': 'video/mp4',
'Origin': ''
},
body: '@FILE_SRC' // placeholder for actual file blob/stream
});
How can I solve that?
Originheader makes no sense, that's a "forbidden header name", you don't get to specify it yourself.