Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pls correct readme because twitter_config not work #66

Open
odykyi opened this issue Oct 5, 2017 · 5 comments
Open

pls correct readme because twitter_config not work #66

odykyi opened this issue Oct 5, 2017 · 5 comments

Comments

@odykyi
Copy link

odykyi commented Oct 5, 2017

Where I need to create this config?
I try create twitter_config file in root and in data directory
its not work

/node_modules/twitter-node-client/lib/Twitter.js:9
    this.consumerKey = config.consumerKey;
                             ^

TypeError: Cannot read property 'consumerKey' of undefined

{
    	"consumerKey": "XXX",
    	"consumerSecret": "XXX",
    	"accessToken": "XXX",
    	"accessTokenSecret": "XXX",
    	"callBackUrl": "XXX"
}

Please create example folder in your repository with example twitter application

@davidvexel
Copy link

It works when you pass your consumer key and access token as process envs, like this:

twitterConsumerKey=<example> twitterConsumerSecret=<example> twitterAccessToken=<example> twitterAccessTokenSecret=<example> node index.js

@odykyi
Copy link
Author

odykyi commented Oct 28, 2017

ok pls add this to readme
twitterConsumerKey=<example> twitterConsumerSecret=<example> twitterAccessToken=<example> twitterAccessTokenSecret=<example> node index.js

@davidvexel
Copy link

@odykyi it just worked for me, I'm not the developer of this plugin.

@chiemekailo
Copy link

I know this is an old thread, but I still wanted to chip in on Craig's earlier guide...

While environment variables are okay, you only need to read the twitter_config file as string, and then JSON.parse it into the function as an object.
Here's how I did it..

    var fs = require('fs');
    fs.readFile('data/twitter_config', 'utf8', function(err, contents) {
         var twitter = new Twitter(JSON.parse(contents));
    });

Works fine.

@odykyi
Copy link
Author

odykyi commented Nov 23, 2018

@chiemekailo could you pls create PR and update readme with yours example
thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants