i stored 3 twitter Api Keys in a Json file
{
"twitter_api": [
{
"consumer_key": "KEY",
"consumer_secret": "KEY",
"access_token_key": "KEY",
"access_token_secret": "KEY"
},
{
"consumer_key": "KEY",
"consumer_secret": "KEY",
"access_token_key": "KEY",
"access_token_secret": "KEY"
},
{
"consumer_key": "KEY",
"consumer_secret": "KEY",
"access_token_key": "KEY",
"access_token_secret": "KEY"
}
Everytime i run my twitter application i want to Import 1 set of api keys randomly. i tried this code
var credentials = require('../settings.json').twitter_api[Math.floor(Math.random()*twitter_api.length)];
But i am getting an Error
anyone know how to do that correctly
Aucun commentaire:
Enregistrer un commentaire