node.js - Twitter API 1.1 OAuth 获取使用数据

标签 node.js oauth twitter twitter-oauth

我阅读了本教程以在 nodejs 中实现 twitter oauth(用于“使用 twitter 登录”目的)- http://codetheory.in/how-to-use-twitter-oauth-with-node-oauth-in-your-node-js-express-application/

最后一段代码有一个名为 results 的变量,它应该保存由 twitter 发回的用户数据,但对我来说它只包含 screen_name 和 user_id 这还不够。我需要更多数据,例如个人资料图片等。

所以我查看了推特文档 - https://dev.twitter.com/docs/api/1/get/users/show
示例 URL 似乎工作正常 - https://api.twitter.com/1/users/show.json?screen_name=TwitterAPI&include_entities=true

但最近我读到推特将很快关闭 API 1 并用 API 1.1 取而代之

所以我尝试了 1.1 API - https://dev.twitter.com/docs/api/1.1/get/users/show
示例 URL 不起作用 - https://api.twitter.com/1.1/users/show.json?screen_name=rsarver

给出错误-

{"errors":[{"message":"Bad Authentication data","code":215}]}

我做错了什么?如何从 Twitter 正确获取用户信息,并希望在使用此模块的 Node.js 代码中获取用户信息 - https://github.com/ciaranj/node-oauth

提前致谢!

最佳答案

API v1.1 endpoints require OAuth authentication .

您可能会查看不同的 oauth 模块:ntwitter

关于node.js - Twitter API 1.1 OAuth 获取使用数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15279565/

相关文章:

node.js - fs.readdirSync 卡住 Electron 应用程序

javascript - 可以在 Node.js 中将变量设置为只读吗

ios - 我可以使用 RestKit 0.20.3 提交带有 Yelp 要求的 OAuth 参数的请求吗?

go - 如何使用 oauth2 在 Go 中实现隐式授权

python - tweepy 流到 sqlite 数据库 - 语法无效

node.js - 模式更改后如何从 mongo 中获取旧记录

javascript - node.js 是否等效于浏览器中的窗口对象

android - 自定义方案似乎没有在应用 Intent 中启动

php - 如何 --> 为推文提供优惠券

ios - iOS开发中的社交网络集成哪个更好?