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: add support for state param for OAuth2 Authorization Code flow #2330

Merged
merged 7 commits into from
May 31, 2024

Conversation

dhananjaykadam
Copy link
Contributor

@dhananjaykadam dhananjaykadam commented May 17, 2024

Issue Reference

#2275

Description

Adding support for state param which is expected on OAuth2 authorization code flow

  • There is also another PR trying to solve same issue but generating state param on the fly, but that is still not merged, so created this in case this is expected, any of two can be merged and other closed.
  • This PR should save the state and reload as well and can allow user to pass whatever state they wants to

image

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.

@dhananjaykadam
Copy link
Contributor Author

Github issue: #2275

@dhananjaykadam dhananjaykadam changed the title feat: add support for state param feat: add support for state param for Oauth2 Authorization Code flow May 17, 2024
@dhananjaykadam dhananjaykadam changed the title feat: add support for state param for Oauth2 Authorization Code flow feat: add support for state param for OAuth2 Authorization Code flow May 17, 2024
Copy link
Contributor

@pietrygamat pietrygamat left a comment

Choose a reason for hiding this comment

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

Besides the issues in this review, I think it's currenlty possible to pass user provided state parameter by simply including it in the auth url. For that reason I believe merging #2114 should take precedence over this one.

@@ -37,6 +37,7 @@ const OAuth2AuthorizationCode = ({ collection }) => {
clientId,
clientSecret,
scope,
state,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should probably be also reset in handlePKCEToggle below.

Copy link
Contributor

Choose a reason for hiding this comment

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

and declared above as well as in inputsConfig.js

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed both reviews, thank for pointing out @pietrygamat

Copy link
Collaborator

Choose a reason for hiding this comment

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

@dhananjaykadam

state prop is missing from the oAuth spread

line-25

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lohxt1 added in spread.

@helloanoop
Copy link
Contributor

@lohxt1 Assigning this to you

Lets make it a priority to have this merged early next week.

@dhananjaykadam dhananjaykadam force-pushed the state-param branch 2 times, most recently from b94bb26 to a1eb80f Compare May 24, 2024 15:18
@dhananjaykadam
Copy link
Contributor Author

Fixed reviews! Feel free to take a look

@dhananjaykadam
Copy link
Contributor Author

Let me know if any more changes are needed to this PR @lohxt1

@@ -37,6 +37,7 @@ const OAuth2AuthorizationCode = ({ item, collection }) => {
accessTokenUrl,
clientId,
clientSecret,
state,
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you also add the state prop inside the updateAuth dispatch fn of handlePKCEToggle

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right missed that, added now

@helloanoop helloanoop merged commit 32b1ba1 into usebruno:main May 31, 2024
@helloanoop
Copy link
Contributor

Merged!

Thanks @dhananjaykadam for working on this!
Thanks @pietrygamat @lohxt1 for the review.

This will go out next Tuesday, June 4th 2024.

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

Successfully merging this pull request may close these issues.

None yet

4 participants