mirror of
https://github.com/coder/coder.git
synced 2026-06-03 21:18:24 +00:00
1a078790b1
Backport of https://github.com/coder/coder/pull/24332 to `release/2.31`.
Moves the `UpdateExternalAuthLink` call to immediately after
`TokenSource.Token()` succeeds (before validation). GitHub rotates
refresh tokens on use, so if post-refresh validation fails (e.g.
rate-limited 403), the new token was previously silently discarded,
forcing manual re-authentication.
Original PR: #24332
Merge commit: 2a1984f0e8
**Note:** This branch includes the cherry-pick of #22904 (optimistic
locking) as a prerequisite since #24332's tests depend on it. The #22904
backport PR is #24902. Once that merges, the overlapping commit in this
PR will be a no-op.
Cherry-picks applied cleanly with no conflicts.
> Generated by Coder Agents
---------
Co-authored-by: Kyle Carberry <kyle@coder.com>
Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>