Twitter API-导致“无效或过期令牌"的原因 [英] Twitter API - Reasons for "invalid or expired token"

查看:201
本文介绍了Twitter API-导致“无效或过期令牌"的原因的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

导致令牌过期(除了让用户取消对应用的授权外)的可能原因是什么?

What are the possible reasons that can cause token to become expired (besides having the user un-authorising the app)?

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

My problem is that I have an app with several thousands of users, all API communication works perfectly but for some users I am getting the invalid or expired token error, my initial though was that they are users who canceled the authentication to the app but I've contacted some of them and they haven't revoked the access.

有什么想法会导致该错误吗?

Any ideas what other issues can cause that error?

推荐答案

随时通过调用它被提及并且通过研究我知道:

Its mentioned and by research I came to know that:

如果用户明确拒绝您的访问令牌,则您的访问令牌将无效设置中的应用程序,或者Twitter管理员暂停了您的应用程序应用.如果您的申请被暂停,则会在上显示一条注释您的应用程序页面说它已被暂停.

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访问令牌无效/已过期?

Why is my twitter oauth access token invalid / expired ?

检查此帖子:无效/已过期访问令牌.

在Google网上论坛中有一篇帖子说:

There is one post in google groups that says:

您没有第二次机会,这是设计使然.OAuth请求具有独特的签名;提交特定请求后,无法再次提交.如果他们正确输入了图钉,一切正常,您将获得访问令牌.如果他们输入的密码错误,您将获得401未经授权-预期的.但是如果他们再次尝试输入图钉,即使是正确的图钉显示为未授权.

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.

在此链接中进行检查.以上参考.

Check this link for the above reference.

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

Some suggestions by twitter employee for the same problem:

我想在这一点上我建议两件事:1.)转到您的应用程序设置,然后使用重置键"标签重置您的消费者密钥和机密,然后在应用程序中更新这些值并验证您仍然看到相同的行为.2.)尝试通过您的request_token呼叫中的oauth_callback.老实说我不这么认为会有所作为,但我想尝试并尽可能做到严格在这里.

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.

也请检查以下讨论说:

您需要使用从返回的oauth_token和oauth_token_secretoauth/access_token调用,而不是应用程序设置中的调用在dev.twitter.com

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

这篇关于Twitter API-导致“无效或过期令牌"的原因的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆