CORS Errors with Box UI Kit
I am using the Content Picker in the Box UI Kit, but when I call the .show() function of the Content Picker, I get the following javascript error on Google Chrome:
Fetch API cannot load https://api.box.com/2.0/folders/0?offset=0&limit=1000&fields=name%2Curl%2Ct…lowed_shared_link_access_levels%2Chas_collaborations%2Cis_externally_owned. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3267' is therefore not allowed access. The response had HTTP status code 401. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
I have added "http://locahost:3267" and "http://localhost" to my allowed CORS domains, but the problem persists. It also occurs on other browsers. For example, in IE11, I receive the following error:
SEC7120: Origin http://localhost:3267 not found in Access-Control-Allow-Origin header.
Is there something else I should be doing, other than adding localhost to the allowed CORS domains? My javascript code intializing the Content Picker is minimal, but seems to be compatible with the code in the tutorial:
var folderID = '0'; var accessToken = getParameterByName('code'); var filePicker = new Box.FilePicker() filePicker.show(folderID, accessToken, { container: '.container' });
Why am I experiencing these errors?
-
Does your folder id / auth token combination work if you use it here https://codepen.io/box-platform/pen/PWPxBm. Replace the values shown in there and click Run on top. Don't save.
サインインしてコメントを残してください。
コメント
12件のコメント