Improve error message when application/x-www-form-urlencoded is not used for token requests
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 3k
- Forks
- 529
- PR merge metrics
- No merged PRs in 30d
Description
Describe the feature
When a client sends an OAuth2 token request with an incorrect Content-Type header (for example, application/json instead of the required application/x-www-form-urlencoded), oauthlib currently responds with unsupported_grant_type.
This is misleading because the grant type itself is correct the issue is the request encoding.
The feature request is to return a more accurate and descriptive error message, such as:
"Content-Type must be application/x-www-form-urlencoded."
Additional context
This improvement would help developers quickly diagnose incorrect request formatting instead of searching for issues with their grant type.
The feature applies to OAuth2 and affects server-side processing of token endpoint requests.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the server-side OAuth2 token endpoint processing described in the issue and reproduce a token request using application/json instead of application/x-www-form-urlencoded. The work is done when the incorrect encoding produces a clear Content-Type error while correctly encoded requests continue to process normally.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, authentication, backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100