Commit 064808d
committed
fix(auth): add Accept: application/json header to OAuth token requests
Some OAuth providers (e.g., GitHub) return form-encoded responses by
default unless the client explicitly requests JSON via the Accept
header. This causes token exchange to fail with a parse error since
the SDK expects JSON responses.
Add 'Accept: application/json' to all token endpoint requests:
- Authorization code token exchange (oauth2.py)
- Token refresh (oauth2.py)
- Client credentials grant (client_credentials.py)
- Private key JWT grant (client_credentials.py)
- Signed JWT assertion grant (client_credentials.py)
This aligns with RFC 6749 Section 5.1 which specifies that token
responses use JSON, and ensures interoperability with providers that
require explicit content negotiation.
Fixes #1523
Signed-off-by: Gaurav Kumar Sinha <gaurav@substrai.dev>1 parent e8e6484 commit 064808d
2 files changed
Lines changed: 8 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
| 95 | + | |
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| |||
320 | 320 | | |
321 | 321 | | |
322 | 322 | | |
323 | | - | |
| 323 | + | |
324 | 324 | | |
325 | 325 | | |
326 | 326 | | |
| |||
481 | 481 | | |
482 | 482 | | |
483 | 483 | | |
484 | | - | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
485 | 488 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
402 | 402 | | |
403 | 403 | | |
404 | 404 | | |
405 | | - | |
| 405 | + | |
406 | 406 | | |
407 | 407 | | |
408 | 408 | | |
| |||
447 | 447 | | |
448 | 448 | | |
449 | 449 | | |
450 | | - | |
| 450 | + | |
451 | 451 | | |
452 | 452 | | |
453 | 453 | | |
| |||
0 commit comments