【问题标题】:Twitter API oauth/request token page does not existTwitter API oauth/请求令牌页面不存在
【发布时间】:2021-12-08 12:15:15
【问题描述】:

使用节点推特包https://www.npmjs.com/package/twitter 推特:https://developer.twitter.com/en/docs/authentication/oauth-1-0a/obtaining-user-access-tokens

我正在尝试为某人发布推文。

告诉我这有什么问题:

var Twitter = require('twitter');

const client = new Twitter({
    consumer_key: process.env.TWITTER_CONSUMER_KEY,
    consumer_secret: process.env.TWITTER_CONSUMER_SECRET,
    access_token_key: process.env.TWITTER_ACCESS_TOKEN_KEY,
    access_token_secret: process.env.TWITTER_ACCESS_TOKEN_SECRET
});

client.post('oauth/request_token', {oauth_callback: process.env.CALLBACKURL})
    .then(response => {
        console.debug('got twitter token',response);
        res.redirect('https://api.twitter.com/oauth/authenticate?oauth_token=' + response.oauth_token)})
    .catch(function(err) {
        console.error('failed to authenticate twitter', 'twitter-lite', err, res.locals.host);
        console.log(err);
    });

[ { message: '对不起,该页面不存在',代码:34 } ]

我在尝试使用 twitter API 时遇到了一些最简单的问题。没有好的例子也无济于事。

【问题讨论】:

    标签: javascript node.js twitter


    【解决方案1】:

    您尝试使用的模块在过去 4 年内未收到任何更新。很可能在那个时候,Twitter 已经更改了他们用于授权/身份验证的 URL。

    您可能应该使用更新一些的东西,例如twitter-api-v2

    【讨论】:

      猜你喜欢
      • 2015-11-17
      • 1970-01-01
      • 2012-06-22
      • 2011-09-05
      • 2017-01-10
      • 2013-10-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多