简体   繁体   English

带有Twitter API 1.1的OAuth2“身份验证错误”

[英]OAuth2 with Twitter API 1.1 “Bad Authentication error”

I am trying to use the Twitter's API (v1.1) through node.js and Oauth2 but I am getting always the same error: 我正在尝试通过node.js和Oauth2使用Twitter的API(v1.1),但我总是遇到相同的错误:

Error: 
{ statusCode: 400,
  data: '{"errors":[{"message":"Bad Authentication data","code":215}]}' }

Here is the snippet of code I am using: 这是我正在使用的代码片段:

http://pastie.org/8708152 http://pastie.org/8708152

Which is based on: 这是基于:

http://webapplog.com/node-js-oauth1-0-and-oauth2-0-twitter-api-v1-1-examples/ http://webapplog.com/node-js-oauth1-0-and-oauth2-0-twitter-api-v1-1-examples/

Any help would be appreciated I spent many hours trying to make it work already. 感谢您的帮助,我花了很多时间尝试使其工作正常。

Apparently the reason it didn't work is that right now Twitter only supports OAuth version 2 for application-based authentication ( https://dev.twitter.com/docs/auth/application-only-auth ). 显然,它不起作用的原因是,目前Twitter仅支持基于应用程序身份验证的OAuth版本2( https://dev.twitter.com/docs/auth/application-only-auth )。

For user based authentication you still need to use OAuth version 1.0A. 对于基于用户的身份验证,您仍然需要使用OAuth 1.0A版本。

Hope this helps for others ! 希望这对其他人有帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM