Commit 3b9c415
committed
fix(oauth): check for oauth error responses even when status code is 200
Certain providers (**cough** GitHub **cough**) return HTTP 200 responses
with an error in the body for their OAuth token exchange and
token refresh endpoints. Previously, we only checked for non-200 status
codes, which could lead to us missing the errors, attempting to
unmarshal the body as a token, failing to detect the error, and even
saving the empty token.
This commit attempts to unmarshal the body as an OAuth error response
even when the status code is 200. If the body is not an OAuth error
response, we fall back to the previous behavior.1 parent 254cb2d commit 3b9c415
2 files changed
+519
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
249 | 262 | | |
250 | | - | |
| 263 | + | |
251 | 264 | | |
252 | 265 | | |
253 | 266 | | |
| |||
679 | 692 | | |
680 | 693 | | |
681 | 694 | | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
682 | 708 | | |
683 | | - | |
| 709 | + | |
684 | 710 | | |
685 | 711 | | |
686 | 712 | | |
| |||
0 commit comments