Getting "missing token ‘authorization’ in CORS header ‘Access-Control-Allow-Headers’ from CORS preflight channel" when using spaces


I’m trying to use the AWS Javascript SDK with spaces but for some reason I’m getting the following error in the Javascript console:

“missing token ‘authorization’ in CORS header ‘Access-Control-Allow-Headers’ from CORS preflight channel”

AFAIK, this is an auth error but I thought the AWS SDK handles auth automatically.

Here is my code:

URL = "https://{$REIGON}"

var ep = new AWS.Endpoint(URL);
var s3 = new AWS.S3({
  endpoint: ep,
  accessKeyId: "{$ACCESSKEY}",
  secretAccessKey: "{$SECRETKEY}",

s3.listBuckets({}, function(err, data) {
  if (err) console.log(err, err.stack);
  else console.log(dat);

  { Bucket: "bucket1", Key: "keyvalue" },
  function (error, data) {
    if (error != null) {
      alert("Failed to retrieve object: " + error);
    } else {
      alert("Loaded" + data.ContentLength + " bytes");

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer