mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-26 01:06:00 +03:00
[GH-ISSUE #3784] [bug]: OAuth 2.0 implementation does not support authorization code flow with PKCE #1319
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#1319
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 @cmaune on GitHub (Jan 29, 2024).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/3784
Is there an existing issue for this?
Current behavior
As mentioned in the readme.md OIDC Access Token/PKCE should be supported.
Currently after filling up all necessary fields for OAuth 2.0 (OpenId Connect Discorvery URL, Authorization URL, Access Token URL, Client Id and Scope) a token request with "client_secret: undefinied" is send to the configured token endpoint.
But for PKCE the clientSecret is not needed.
This leads at least with Azure as an identity plaform to an error.
Further more the input validation only seems to kick off after a "browser" refresh.
When creating a new request and filling up all necessary fields for PKCE the request is send, after a browser refresh clicking the button "Generate token" leads to a warning "No client secret defined"
Possible Fix:
Steps to reproduce
Environment
Production
Version
Cloud
@tonnico commented on GitHub (Feb 13, 2024):
Is there a workaround until the problem is fixed?
@aconstantin commented on GitHub (Feb 13, 2024):
Do you need any help here? Should we try to provide a fix? If yes, can you provide some guidance?
@MarcelHoell commented on GitHub (Feb 29, 2024):
That fix would be pretty nice!
@StormicK commented on GitHub (Apr 18, 2024):
Are there any news about this topic?
@mkohns commented on GitHub (Apr 28, 2024):
Hi. I would like to follow up on this:
I am using Desktop App Version: Version 24.3.1-2 (20240423.091309)
When configuring "Authorization" Tab for a REST call to use OAuth2 with PKCE the "client_secret" seems to be mandatory. If you do not provide it - hoppscotch shows a toast message with validation error.
From my point of view the OAuth2 with PKCE for so called public clients should not have a secret provided.
This is due to the fact as the secret can not be stored securely in SPAs, Mobile Apps or Desktop Apps which does not have a backend for authentication.
If you try to provide an client secret - the Azure AD (now EntraID) also identifies this and responses an error:
{"error":"invalid_client","error_description":"AADSTS700025: Client is public so neither 'client_assertion' nor 'client_secret' should be presented}.From my perspective the code change could look like this:
make client_secret optional if PKCE is enabled:
github.com/hoppscotch/hoppscotch@844eee0fa4/packages/hoppscotch-common/src/services/oauth/flows/authCode.ts (L33)only append client_secret if also provided by user:
github.com/hoppscotch/hoppscotch@844eee0fa4/packages/hoppscotch-common/src/services/oauth/flows/authCode.ts (L206)The rest looks great to me.
@amk-dev and @jamesgeorge007 seemed to implemented this great feature.
Could you please comment here?
@mkohns commented on GitHub (Apr 28, 2024):
I have set up the local dev environment for the hoppscotch desktop application and just uncommented the above lines for testing. I can confirm that the auth flow is then working as expected. Nice.
@liyasthomas commented on GitHub (Apr 28, 2024):
cc: @amk-dev can you follow-up this?
@kbakeradi commented on GitHub (May 3, 2024):