I am facing the same problem.
Though, I resolved this using redis
Put twitter variables into .env file
Back in the root of your project, create a file called .env. This will be used to store our local configuration variables that we will access from our code. Paste the following stub into the .env file and fill in the values.
TWITTER_CONSUMER_KEY=INSERT_KEY_HERE
TWITTER_CONSUMER_SECRET=INSERT_KEY_HERE
TWITTER_ACCESS_TOKEN=INSERT_KEY_HERE
TWITTER_ACCESS_SECRET=INSERT_KEY_HERE
DEBUG_USER=INSERT_USERNAME_HERE
Going through the trouble of hiding our secrets in .env doesn’t do us any good if we publish the file to github. So open .gitignore and add the following line:
*.env
Example -
This is in the main.js file -
var redis = require('redis');
var T = new Twit({
consumer_key: process.env.TWITTER_CONSUMER_KEY,
consumer_secret: process.env.TWITTER_CONSUMER_SECRET,
access_token: process.env.TWITTER_ACCESS_TOKEN,
access_token_secret: process.env.TWITTER_ACCESS_SECRET
});