mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-26 01:06:00 +03:00
[GH-ISSUE #3855] [bug]: OAuth 2.0 token request has JSON body #1353
Labels
No labels
CodeDay
a11y
browser limited
bug
bug fix
cli
core
critical
design
desktop
discussion
docker
documentation
duplicate
enterprise
feature
feature
fosshack
future
good first issue
hacktoberfest
help wanted
i18n
invalid
major
minor
need information
need testing
not applicable to hoppscotch
not reproducible
pull-request
question
refactor
resolved
sandbox
self-host
spam
stale
testmu
wip
wont fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hoppscotch#1353
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @GREsau on GitHub (Feb 23, 2024).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/3855
Is there an existing issue for this?
Current behavior
As part of the flow for generating a token using OAuth 2.0 authorization, hoppscotch sends a POST request to the authorization server's token endpoint.
The request looks similar to this (unimportant request headers omitted, line breaks added for readability):
One problem is that, despite the fact the request content is serialized as JSON, the
Content-Typerequest header is set toapplication/x-www-form-urlencoded, presumably because that's the axios default.However, the fact the request content is JSON is itself a problem, because RFC 6749 section 4.1.3 requires that the request content is serialized to the
application/x-www-form-urlencodedformat. Some identity providers allow JSON requests as an extension of OAuth, but the authorization server I'm trying to use does not. According to the spec, the request should instead be something like (again, unimportant request headers omitted and line breaks added for readability):Some servers may also require the client credentials to be sent in the
Authorizationrequest header using basic authentication instead of in the request content, but this is not required by the spec.Steps to reproduce
Environment
Production
Version
Local
@GREsau commented on GitHub (Feb 23, 2024):
The actual code fix for this should be fairly straightforward - changing the
JSON.stringifyhere to a function that serializes as form-urlencoded.I'd be happy to submit a PR for this, although I don't know how to build the app locally to test changes
@zhuhaozheng123 commented on GitHub (Mar 7, 2024):
sda