twitter - 如何在服务器端处理 Oauth nonces?

标签 twitter oauth oauth-provider

我正在服务器端编写 OAuth 协议(protocol)的提供者部分,并且我正在研究我需要缓存的 OAuth 消费者发送的随机数。

根据推特的文档,

Twitter will only allow a nonce to be used once by your application. Prevents replayed requests.



问题:我的实现只是简单地将收到的每个 nonce 添加到 memcached 中。但这会占用大量内存空间。理想情况下我应该缓存多少随机数以及多长时间?

最佳答案

Nonce 只需要对于使用相同时间戳的所有请求是唯一的。您应该拒绝时间戳早于 5 分钟的请求,因此您只需将 nonce 存储 5 分钟。
https://www.rfc-editor.org/rfc/rfc5849#section-3.3

关于twitter - 如何在服务器端处理 Oauth nonces?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3732891/

相关文章:

google-app-engine - 获取用于访问 Google 域下用户数据的持久性 token

oauth - Google 随机数最大长度

python - 使用 django-allauth 启用 oauth 登录,但使用自定义提供程序

android - 向下拖动时,Android List View 动画

linux - 带有状态/过滤器超时的 Twurl

security - Facebook 如何验证/授权其官方本地客户端?

oauth-2.0 - 使用 DotNetOpenAuth 创建 OAuth 2.0 服务提供者

java - 如何识别 Twitter4j RateLimitStatusEvent 包含哪个端点的限制

angularjs - 如何在 Ionic 应用程序中显示 Twitter 时间线?

asp.net - 使用 asp.net 4.5 OAuth 用 clientid 和 secret 注册谷歌