gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 18:15:45 27 4
gpt4 key购买 nike

我正在服务器端编写 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/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com