mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2026-03-09 04:32:44 -05:00
[PR #6866] Add 30s cache to SSO exchange_refresh_token #7492
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/dani-garcia/vaultwarden/pull/6866
Author: @Timshel
Created: 2/23/2026
Status: 🔄 Open
Base:
main← Head:fix/refresh_token📝 Commits (1)
5b8fbd7Add 30s cache to SSO exchange_refresh_token📊 Changes
3 files changed (+37 additions, -138 deletions)
View changed files
📝
Cargo.lock(+6 -119)📝
Cargo.toml(+1 -1)📝
src/sso_client.rs(+30 -18)📄 Description
This add a cache to the
refresh_tokenendpoint to prevent calling a provider twice with the same token (some providers prevent reuse).I contributed a patch to the clients to prevent the issue https://github.com/bitwarden/clients/pull/10799.
But it appears some users still have issues: Ex: https://github.com/dani-garcia/vaultwarden/issues/6311#issuecomment-3775829084.
Looking at the client code I couldn't identify how to reproduce the issue :(.
But at the same time the fix is relatively trivial, so I believe it's worth to integrate it (Only issue I could see is it'won't work in multinode setup unless some affinity is set at the loadbalancer).
Switched to
Mokato be able to useget_with.Did not change the current
CLIENT_CACHEsince it's not an issue if two clients are instantiated andApiResultis not Cloneable so it would be kind of a pain to replace.The capacity is a bit random just though it was better not to let it unbounded and the 30s should be way enough to handle any concurrent calls without keeping it around too long which would negate the utility of rolling tokens.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.