简体   繁体   English

从 Twitter API 获取不记名令牌的问题

[英]Problem getting Bearer Token from Twitter API

I'm trying to get set up to use the Twitter API (Application-only Authentication) and am having trouble getting the bearer token so I can start making calls.我正在尝试设置为使用 Twitter API(仅应用程序身份验证),但在获取不记名令牌时遇到问题,因此我可以开始拨打电话。 Specifically, I'm getting HTTP 403具体来说,我收到了 HTTP 403

{
    "code": 99,
    "message": "Unable to verify your credentials",
    "label": "authenticity_token_error"
}

I have the App and Dev Environment set up and have my credentials (API key and API secret key).我已经设置了应用程序和开发环境并拥有我的凭据(API 密钥和 API 密钥)。

I am using the Talend API Tester for all of this.我正在使用 Talend API Tester 来完成所有这些工作。

I'm just not seeing the problem.我只是没有看到问题。 Here is the sample request from the Twitter docs and below that, my request, straight from the browser.这是来自 Twitter 文档的示例请求,下面是我的请求,直接来自浏览器。

Twitter Example:推特示例:

POST /oauth2/token HTTP/1.1
Host: api.twitter.com
User-Agent: My Twitter App v1.0.23
Authorization: Basic eHZ6MWV2RlM0d0VFUFRHRUZQSEJvZzpMOHFxOVBaeVJnNmllS0dFS2hab2xHQzB2SldMdzhpRUo4OERSZHlPZw==
Content-Type: application/x-www-form-urlencoded;charset=UTF-8
Content-Length: 29
Accept-Encoding: gzip

grant_type=client_credentials

My actual Request:我的实际要求:

POST /oauth2/token HTTP/1.1
Authorization: Basic ektCUTl5Q0tWRERVUVFwUDJXYzljWlpyYTowM1ZIb -- not really a key -- xhaHByMmlqWld3RkIxa1gxaXZ6cQ==
User-Agent: My App
Accept-Encoding: gzip
Content-Length: 29
Content-Type: application/x-www-form-urlencoded;charset=UTF-8
Host: api.twitter.com

grant_type=client_credentials

Outside of the Authorization and User-Agent headers, they're identical.在 Authorization 和 User-Agent 标头之外,它们是相同的。

Because the Talend API Tester takes the username and password and does the Base 64 encoding for the Authorization header, I even took the API key, put it together wit the API secret key, with a colon delimiting them (per the Twitter docs) and did the Base 64 encoding manually and got the same value that is being sent in the Request.因为 Talend API Tester 获取用户名和密码并对 Authorization 标头进行 Base 64 编码,我什至获取了 API 密钥,将它与 API 密钥放在一起,用冒号分隔它们(根据 Twitter 文档)并执行手动进行 Base 64 编码并获得与请求中发送的值相同的值。

I did read that if you make too many requests you can get the 403, basically timing you out, but the Request above was just made with fresh keys and 24+ hours after my last try.我确实读过,如果你提出太多请求,你可以获得 403,基本上是让你超时,但上面的请求只是用新的密钥和我上次尝试后 24 小时后提出的。 If I'm timed out, I'm not sure how long it lasts.如果我超时,我不确定它会持续多久。

Welp.好。 I decided to try this request using Postman and somewhat shockingly, it worked the first time.我决定使用 Postman 尝试这个请求,有点令人震惊的是,它第一次成功了。 Not sure what the problem is with the Talend API Tester, but it fails miserably here.不确定 Talend API Tester 的问题是什么,但它在这里惨遭失败。

暂无
暂无

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

相关问题 使用承载令牌在Twitter API中获取用户信息 - Get user information in Twitter API using bearer token 邮递员上的授权类型承载令牌,并从 API 请求数据,这需要带有颤振的令牌承载 - authorization type bearer token on postman and request data from the API which requires a token bearer with flutter 尝试从 Reactjs 中的不记名令牌中获取数据时出错 - getting an error while trying to fetch a data from a bearer token in Reactjs 使用 Twitter API - 如何使用不记名令牌获得参与端点的身份验证 - with the Twitter API - how can I get authentication for the engagement endpoint using a bearer token How to hit sonarQube api with username and api token in postman.(bearer token and username password is working Problem with UserName and Api Token) - How to hit sonarQube api with username and api token in postman.(bearer token and username password is working Problem with UserName and Api Token) Laravel自己的API使用带有令牌的控制器的消耗 - laravel own api consumption from controller with bearer token 自动获取 Mojang 不记名令牌 - Automatically getting Mojang bearer token 如何从不记名令牌 laravel api 获取用户详细信息 - How to get user details from bearer token laravel api 如何使用来自世界各地的任何人的不记名令牌发出 API 请求? - How to make API request with bearer token from anyone around the world? Flutter http 无法从 .NET Api 获取 Bearer Token - Flutter http can't get Bearer Token from .NET Api
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM