<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard ' in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/The-value-of-the-Access-Control-Allow-Origin-header-in-the/m-p/207843#M16838</link>
    <description>&lt;P&gt;Thanks!&amp;nbsp;Based on your code, it looks like you're running this in a Meteor app.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried it out in a Meteor app, and I wasn't able to reproduce the issue when making an upload code in the 'server' code, but I was when I&amp;nbsp;tried to run it in the 'client' code. Are you running this in the client code?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not sure offhand if this is something we can support, so instead you can either:&lt;/P&gt;
&lt;P&gt;- run this in your 'server' code.&lt;BR /&gt;- import the JavaScript SDK as a JavaScript library on the page and use the normal browser interface.&lt;/P&gt;</description>
    <pubDate>Tue, 21 Feb 2017 19:17:26 GMT</pubDate>
    <dc:creator>Greg-DB</dc:creator>
    <dc:date>2017-02-21T19:17:26Z</dc:date>
    <item>
      <title>The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*'</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/The-value-of-the-Access-Control-Allow-Origin-header-in-the/m-p/207235#M16835</link>
      <description>&lt;P&gt;Hey guys I am using npm package to work with dropbox. However when I try to upload a file I get the following error&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;XMLHttpRequest cannot load &lt;A href="https://content.dropboxapi.com/2/files/upload" target="_blank"&gt;https://content.dropboxapi.com/2/files/upload&lt;/A&gt;. Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. Origin 'http://localhost:3000' is therefore not allowed access. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea why is this happening and what can I do about this?&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:25:44 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/The-value-of-the-Access-Control-Allow-Origin-header-in-the/m-p/207235#M16835</guid>
      <dc:creator>hayk</dc:creator>
      <dc:date>2019-05-29T09:25:44Z</dc:date>
    </item>
    <item>
      <title>Re: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/The-value-of-the-Access-Control-Allow-Origin-header-in-the/m-p/207306#M16836</link>
      <description>Thanks for the post. We'll be happy to help with this. Can you let me know what version of the library you're using, and share the code that reproduces this issue? Thanks in advance!</description>
      <pubDate>Fri, 17 Feb 2017 18:10:56 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/The-value-of-the-Access-Control-Allow-Origin-header-in-the/m-p/207306#M16836</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2017-02-17T18:10:56Z</dc:date>
    </item>
    <item>
      <title>Re: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/The-value-of-the-Access-Control-Allow-Origin-header-in-the/m-p/207568#M16837</link>
      <description>&lt;P&gt;Hi Greg!&lt;/P&gt;&lt;P&gt;I'm using dropbox@2.5.1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And here is the code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;import Dropbox from 'dropbox'

uploadCallback (file,self) {
    // TODO: Integrate dropbox with its SDK
    // TODO: Pass the link to the editor
    // const self = this
    console.log(self)
    return new Promise(
      (resolve, reject) =&amp;gt; {
        console.log('uploadCallback promise')
        console.log('file', file)
        const dataObject = {
          file,
          resolve,
          reject
        }
        console.log('dataObject', dataObject)
        self.uploadToDropbox(dataObject)
      }
    )
  }

uploadToDropbox (dataObject) {
    const dbx = new Dropbox({accessToken: Meteor.settings.public.dropbox.accessToken})
    console.log('dataObject', dataObject)
    const { file } = dataObject
    console.log('file', file)
    const { resolve, reject } = dataObject
    console.log('resolve', resolve)
    console.log('reject', reject)
    dbx.filesUpload({path: '/' + file.name, contents: file})
      .then(function (response) {
        console.log(response)
        resolve({ data: { link: 'http://dummy_image_src.com' } })
      })
      .catch(function (error) {
        console.error(error)
        reject('some error')
      })
    return false
  }&lt;/PRE&gt;&lt;P&gt;Do you have any ideas?&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2017 06:08:57 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/The-value-of-the-Access-Control-Allow-Origin-header-in-the/m-p/207568#M16837</guid>
      <dc:creator>hayk</dc:creator>
      <dc:date>2017-02-20T06:08:57Z</dc:date>
    </item>
    <item>
      <title>Re: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/The-value-of-the-Access-Control-Allow-Origin-header-in-the/m-p/207843#M16838</link>
      <description>&lt;P&gt;Thanks!&amp;nbsp;Based on your code, it looks like you're running this in a Meteor app.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried it out in a Meteor app, and I wasn't able to reproduce the issue when making an upload code in the 'server' code, but I was when I&amp;nbsp;tried to run it in the 'client' code. Are you running this in the client code?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not sure offhand if this is something we can support, so instead you can either:&lt;/P&gt;
&lt;P&gt;- run this in your 'server' code.&lt;BR /&gt;- import the JavaScript SDK as a JavaScript library on the page and use the normal browser interface.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2017 19:17:26 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/The-value-of-the-Access-Control-Allow-Origin-header-in-the/m-p/207843#M16838</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2017-02-21T19:17:26Z</dc:date>
    </item>
    <item>
      <title>Re: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/The-value-of-the-Access-Control-Allow-Origin-header-in-the/m-p/207939#M16839</link>
      <description>&lt;P&gt;Hi Greg!&lt;/P&gt;
&lt;P&gt;Thanks for your reply and you got it all right!&lt;/P&gt;
&lt;P&gt;Would you mind if I ask how you used the sdk in the server?&lt;/P&gt;
&lt;P&gt;You see at first I tried using it in the server however I got problems passing the file object to a Meteor method in the server. Then I convereted the file to base64 send it to the server and was able to upload to dropbox, however the image was empty. So I thought the problem may be while passing file from client to server thus it would be better to directly upload to dropbox from the client. And then I got this headers' error. But I am pretty much sure I am overcomplicating something and there is a simpler solution.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2017 06:29:11 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/The-value-of-the-Access-Control-Allow-Origin-header-in-the/m-p/207939#M16839</guid>
      <dc:creator>hayk</dc:creator>
      <dc:date>2017-02-22T06:29:11Z</dc:date>
    </item>
    <item>
      <title>Re: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/The-value-of-the-Access-Control-Allow-Origin-header-in-the/m-p/208034#M16840</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I used an example Meteor app, and in server/main.js I just used the node library normally:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;var Dropbox = require('dropbox');&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;    const dbx = new Dropbox({accessToken: "&amp;lt;ACCESS_TOKEN&amp;gt;"})
    dbx.filesUpload({path: "/test_207235.txt", contents: "some test data"})
      .then(function (response) {
        console.log(response)
      })
      .catch(function (error) {
        console.error(error)
      })&lt;/PRE&gt;
&lt;P&gt;That uploaded the file successfully. Attempting the same in client/main.js failed with the same error you got.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't have a more advanced sample available though. The&amp;nbsp;filesUpload method takes a string or buffer, but beyond that I'm afraid I can't offer much insight as to how to manage files/data in node and Meteor themselves.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to upload directly from the user's browser, you can use the JavaScript SDK in&amp;nbsp;the browser's JavaScript. E.g., include the library via a script tag in your HTML, and run JavaScript from a script tag, as shown in the &lt;A href="https://github.com/dropbox/dropbox-sdk-js/blob/master/examples/basic/index.html" target="_self"&gt;basic browser example&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2017 19:16:49 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/The-value-of-the-Access-Control-Allow-Origin-header-in-the/m-p/208034#M16840</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2017-02-22T19:16:49Z</dc:date>
    </item>
    <item>
      <title>Re: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/The-value-of-the-Access-Control-Allow-Origin-header-in-the/m-p/208117#M16841</link>
      <description>&lt;P&gt;Hi dear Greg,&lt;/P&gt;
&lt;P&gt;I found the way to upload my file. The problem was in the way I was creating the buffer. So now I am able to upload from my server. I'm putting a gist here in case anyone will need it.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://gist.github.com/hayk94/2a11702a3476f49bd65e36e7fa715d90" target="_blank"&gt;https://gist.github.com/hayk94/2a11702a3476f49bd65e36e7fa715d90&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Though now I need to get a link of the image to show it in my HTML and there seems to be no way to do that programmatically, but I think that is another story therefore I created a new topic&amp;nbsp;&lt;A href="https://www.dropboxforum.com/t5/API-support/Share-and-get-the-link-via-api/m-p/208116#M10220" target="_blank"&gt;https://www.dropboxforum.com/t5/API-support/Share-and-get-the-link-via-api/m-p/208116#M10220&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Feb 2017 07:20:16 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/The-value-of-the-Access-Control-Allow-Origin-header-in-the/m-p/208117#M16841</guid>
      <dc:creator>hayk</dc:creator>
      <dc:date>2017-02-23T07:20:16Z</dc:date>
    </item>
  </channel>
</rss>

