mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-25 16:55:59 +03:00
[PR #4927] [MERGED] fix(common): oauth2 basic header encoding #4988
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#4988
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?
📋 Pull Request Information
Original PR: https://github.com/hoppscotch/hoppscotch/pull/4927
Author: @qhris
Created: 3/21/2025
Status: ✅ Merged
Merged: 3/28/2025
Merged by: @jamesgeorge007
Base:
next← Head:fix/outh2-basic📝 Commits (1)
fad0696fix(common): oauth2 basic header encoding📊 Changes
1 file changed (+10 additions, -1 deletions)
View changed files
📝
packages/hoppscotch-common/src/services/oauth/flows/clientCredentials.ts(+10 -1)📄 Description
Fixes the basic auth header encoding in accordance with RFC 6749.
Using OAuth2 and selecting
Send credentials as Basis Authusing any client secret with special characters such as+, or§will result in a failure to fetch the token.According to RFC 6749 section 2.3.1 (the OAuth spec) the client ID and the secret should be encoded in accordance with
application/x-www-form-urlencoded.I you want me to create an issue for this I can, but I had already solved it once I finished debugging.
What's changed
Before base64 encoding the header value, a new function will properly encode the username and password parts separately before encoding it.
As a sidenote,
encodeURIComponentencodes spaces as%20and not+as specified byapplication/x-www-form-urlencoded. There is a note on the MDN site for this.Before
After
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.