desmondmorris / node-twitter

Client library for the Twitter REST and Streaming API's.
https://www.npmjs.com/package/twitter
MIT License
1.27k stars 237 forks source link

Question about trends/places api #323

Open chorlick opened 5 years ago

chorlick commented 5 years ago

Working with this package and having an issue getting the trends/place api working

tp.getCurrentTrendingTopics(2428184);

getCurrentTrendingTopics(woeid) {
        var client = new Twitter({
            consumer_key: '',
            consumer_secret: '',
            access_token_key: '',
            access_token_secret: ''
        });

        client.get("trends/place?id=" + woeid, function (error, tweets, response) {
            if (error) {
                throw error;
            }
            console.log(response.body)
        });
    }

Pretty simple but Im constantly getting a 403 error back from twitter. I have valid application credentials. I am able to query my own rate limit data and hit the other /trends api endpoints successfully. Below is the console.

C:\Users\\code\twitter_peel\src\twitter-peel.js:42
                throw error;
                ^

Error: HTTP Error: 403 Forbidden
    at Request._callback (C:\Users\\code\twitter_peel\node_modules\twitter\lib\twitter.js:221:9)
    at Request.self.callback (C:\Users\\code\twitter_peel\node_modules\request\request.js:185:22)
    at emitTwo (events.js:126:13)
    at Request.emit (events.js:214:7)
    at Request.<anonymous> (C:\Users\\code\twitter_peel\node_modules\request\request.js:1161:10)
    at emitOne (events.js:116:13)
    at Request.emit (events.js:211:7)
    at IncomingMessage.<anonymous> (C:\Users\\code\twitter_peel\node_modules\request\request.js:1083:12)
    at Object.onceWrapper (events.js:313:30)
    at emitNone (events.js:111:20)

Im new to the twitter api so Im not sure if i have a actual auth issue or something else. Anyone else having any issues?