BrightcoveLearning / 18302-cms-api-sample-download-links

In this sample, you will learn how to use the CMS API to generate a table of download links for the best MP4 renditions of your videos.
MIT License
0 stars 2 forks source link

Error cors #1

Open kamalkech opened 2 years ago

kamalkech commented 2 years ago

Getting this error:

ccess to XMLHttpRequest at 'https://solutions.brightcove.com/bcls/bcls-proxy/bcls-proxy-v2.php' 
from origin 'http://127.0.0.1:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' 
header is present on the requested resource.

How enable cors ? there is option to add for this error when try to test locally

rcrooks commented 2 years ago

HI @kamalkech we had to add code to our proxy to allow requests only from Brightcove domains (orders from our security group). However, if you have somewhere to host it that supports PHP, we have a plain vanilla version of the code here: https://github.com/BrightcoveLearning/bcls-proxy.js

I hope that helps.

kamalkech commented 2 years ago

@rcrooks i clone repo when start it i got:

/mnt/E656FADC56FAAC85/Projects/Vanilla/bcls-proxy.js/bcls-proxy.js:126
        if (req.headers.origin.indexOf("localhost") < 0) {
                               ^

TypeError: Cannot read properties of undefined (reading 'indexOf')
    at Server.<anonymous> (/mnt/E656FADC56FAAC85/Projects/Vanilla/bcls-proxy.js/bcls-proxy.js:126:32)
    at Server.emit (node:events:527:28)
    at parserOnIncoming (node:_http_server:951:12)
    at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17)

Node.js v17.6.0
kamalkech commented 2 years ago

for Your request cannot be processed; this proxy only handles requests originating from a local web server. If you would like to build your own version of this proxy, see http://docs.brightcove.com/en/perform/oauth-api/guides/quick-start.html

this link not working !!