0

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?

1
  • Trying to set the Origin header makes no sense, that's a "forbidden header name", you don't get to specify it yourself. Commented Jun 30 at 6:57

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.