title: Twitter API App auth, CORS issue
body: <p>I am trying to fetch all the tweets from hillary and trump for a job proposal as a junior dev (starting out :)), and I keep running into a CORS problem. Any help would mean the world to me!</p>
  
  <p>I'm trying to use Application Only based authentication and not User based, so I got the bearer token, my key and secret, stored them in a separate page, used them to fill</p>
  
  <pre><code>`var client = new Twitter({
    consumer_key: '',
    consumer_secret: '',
    bearer_token: ''
  });`
  </code></pre>
  
  <p>and tried to make a get request with it as detailed on the npm twitter documentation with:</p>
  
  <pre><code>`twitter.client.get(`${twitter.TWITTER_URL}search/tweets.json?q=@realDonaldTrump&amp;result_type=mixed&amp;count=2`, null, function(error, tweets, response) {
          if(error) throw error;
          console.log(response);
          console.log(tweets);
      })`
  </code></pre>
  
  <p>However I run into a CORS error when I just omit the params, and when I set params as null (as in the example above), it breaks. Any suggestions?</p>
  
  <p>P.S. also, they suggest storing the sensitive keys in the <code>params.env</code>  how do I do that? I just stored them in another file and imported them, then .gitignore the keys. Here is my result: </p>
  
  <pre><code>`import * as keys from "../../API_KEYS/API_KEYS";`
  
  `import Twitter from "twitter";`
  
  
  `export const TWITTER_URL = "https://api.twitter.com/1.1/"`
  
  `export const client = new Twitter({
    consumer_key: keys.CONSUMER_KEY,
    consumer_secret: keys.CONSUMER_SECRET,
    bearer_token: keys.BEARER_TOKEN
  });`
  </code></pre>
  
  <p>And here is their suggestion:</p>
  
  <pre><code>`var client = new Twitter({
    consumer_key: process.env.TWITTER_CONSUMER_KEY,
    consumer_secret: process.env.TWITTER_CONSUMER_SECRET,
    bearer_token: process.env.TWITTER_BEARER_TOKEN
  });`
  </code></pre>