Commit f7e365c
committed
fix: deduplicate concurrent OAuth refresh token exchanges
When multiple parallel requests receive 401 responses, each
independently calls onUnauthorized -> handleOAuthUnauthorized ->
refreshAuthorization with the same refresh token. OAuth providers
using rotating refresh tokens (Atlassian, Asana, per RFC 6819
5.2.2.3) detect the second use as a replay attack and revoke the
entire token family, logging the user out.
The fix adds promise coalescing in adaptOAuthProvider: the first
401 handler stores its refresh promise, and all concurrent 401s
await the same promise instead of initiating separate refresh
exchanges. The promise is cleared after completion (success or
failure) so future token refreshes proceed normally.
Closes #17601 parent cce3ac7 commit f7e365c
1 file changed
Lines changed: 14 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| 123 | + | |
123 | 124 | | |
124 | 125 | | |
125 | 126 | | |
126 | 127 | | |
127 | 128 | | |
128 | | - | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
129 | 142 | | |
130 | 143 | | |
131 | 144 | | |
| |||
0 commit comments