api - Twitter API - "invalid or expired token"的原因

标签 api twitter token twitter-oauth

可能导致 token 过期的原因有哪些(除了用户取消对应用程序的授权之外)?

我的问题是,我有一个拥有数千名用户的应用程序,所有 API 通信都工作正常,但对于某些用户,我收到 无效或过期 token 错误,但我最初的想法是,他们是取消了应用身份验证的用户,但我已经联系了其中一些用户,他们还没有撤消访问权限。

您知道还有哪些其他问题可能导致该错误吗?

最佳答案

通过调用 GET account/verify_credentials 随时检查访问 token 的完整性使用该访问 token 时。

它被提及,通过研究我了解到:

Your access token will be invalid if a user explicitly rejects your application from their settings or if a Twitter admin suspends your application. If your application is suspended there will be a note on your application page saying that it has been suspended.

为什么我的 Twitter oauth 访问 token 无效/过期?

查看此帖子:invalid / expired access tokens .

Google 群组中有一篇帖子说:

You don't get a second chance, and this is by design. OAuth requests have a unique signature; once a particular request is submitted, it can't be submitted again. If they enter the pin correctly, all is well, you get an access token. If they enter the pin wrong, you get 401 Unauthorized - which is expected. But if they then try again to enter the pin, even the correct pin shows as unauthorized.

检查这个link以上供引用。

twitter 员工针对同一问题的一些建议:

I guess there are two things I would suggest at this point: 1.) Go to your application settings and use the "Reset keys" tab to reset your consumer key and secret, then update those values in the app and verify that you still see the same behavior. 2.) Try passing oauth_callback in your request_token call. Honestly I don't think this will make a difference, but I want to try and be as rigorous as I can here.

另请检查此 discussion说:

You need to use the oauth_token and oauth_token_secret returned from the oauth/access_token call instead of the one in your app's settings in dev.twitter.com

关于api - Twitter API - "invalid or expired token"的原因,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17636701/

相关文章:

api - 有没有一种方法可以将具有特定_id的文档索引到Elasticsearch中?

c# - YouTube API v3在上传过程中引发异常

python - 标记列表列表

twitter - 如果我调用 Twitter API 来获取我的所有关注者,那么对该 API 的调用次数是多少?

c - 词法分析器将标识符的一部分识别为关键字

Twitter oauth 请求 token 响应代码 401

javascript - 在不同浏览器中打开页面时, token 未保存在 $window.sessionStorage 中

python - Spotify API 在尝试获取播客信息时返回 404 not found

API 设计 - 一个域上的应用程序,不同域上的 api。如何在不传递用户 ID 的情况下检索用户特定数据

twitter - 为什么 Twitter API 返回错误 'If you need access to this endpoint, you may need a different access level?'