Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: OAuth 2.0 Client Credentials Basic Auth #2164

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

pietrygamat
Copy link
Contributor

@pietrygamat pietrygamat commented Apr 25, 2024

Description

With this change the OAuth2 authorization on request and collection level is now including additional configuration option for handling client credentials when accessing token endpoint. This applies to all currently supported grant_types.

The new default option is to send the credentials as Authorization: Basic header:

auth:oauth2 {
  ...
  client_id: brunoclient
  client_secret: {{client_secret}}
  client_secret_method: client_credentials_basic
}

The old behavior to include them in the request body is still available.

auth:oauth2 {
  ...
  client_id: brunoclient
  client_secret: {{client_secret}}
  client_secret_method: client_credentials_post
}

resolves #2106
#1003

Contribution Checklist:

  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.

Publishing to New Package Managers

Please see here for more information.

@pietrygamat pietrygamat changed the title Feature/oauth2 basic auth feat: OAuth 2.0 Client Credentials Basic Auth Apr 25, 2024
@pietrygamat pietrygamat force-pushed the feature/oauth2-basic-auth branch 2 times, most recently from 8a24c7f to 684a4bb Compare April 25, 2024 07:55
import { useDispatch } from 'react-redux';
import { humanizeOAuth2ClientSecretMethod } from 'utils/collections';

const ClientCredentialsMethodSelector = ({ item, collection, oAuth }) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same component is used in RequestPane and in CollectionSettings/Auth. While the convention in the project seems to be using duplicate, almost identical components, I feel this approach is easier to manage. Perhaps it should be moved into a different location then?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seconded - perhaps we should have a shared components directory

Comment on lines -126 to -133
request.data = {
grant_type: 'password',
username,
password,
client_id: clientId,
client_secret: clientSecret,
scope
};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am pretty sure the interpolate-vars has no business updating request.data like this. The oauth2-helper knows best what is and what is not to be included in request data, right?

@rmaheedharan
Copy link

Much Needed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OAuth 2.0 Client Credentials Basic Auth
4 participants