You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pkg/auth/oauth: factor shared non-caching refresher and lift duplicated helpers #5066
All scope from this issue has been addressed as part of #5050 (Extract shared OAuthTokenSource from pkg/registry/auth and pkg/llm).
Original context
Flagged in #5052 (review by @JAORMX). pkg/llm/tokensource.go introduced nonCachingRefresher, which does the same cfg.Exchange(ctx, "", opts...) dance as pkg/auth/oauth/resourceTokenSource (resource_token_source.go:88). The only meaningful difference is that resourceTokenSource.Token() short-circuits on r.token.Valid() (line 45), which is exactly what withPreemptiveRefresh needs to not happen.
Scope 1 — Non-caching refresher:NonCachingRefresher was already extracted to pkg/auth/oauth in #5052. resourceTokenSource delegates to it. pkg/llm.nonCachingRefresher was removed as part of the #5050 extraction — the shared type is used via pkg/auth/tokensource.
Scope 2 — Lifted helpers:
ensureOfflineAccess → tokensource.EnsureOfflineAccess in pkg/auth/tokensource
DeriveSecretKey → tokensource.DeriveSecretKey(prefix, url, issuer) (parameterized prefix) in pkg/auth/tokensource
Both helpers are now shared across pkg/llm and pkg/registry/auth; the duplicates have been deleted.
Closing in favour of #5050 which covers the same ground as a superset. The NonCachingRefresher extraction and the ensureOfflineAccess/DeriveSecretKey helper lifts are part of the shared OAuthTokenSource refactor scoped there.
Activity
yrobla commentedon Apr 28, 2026
Closing in favour of #5050 which covers the same ground as a superset. The
NonCachingRefresherextraction and theensureOfflineAccess/DeriveSecretKeyhelper lifts are part of the sharedOAuthTokenSourcerefactor scoped there.