Skip to content

Fix #1683 allow OAuth2 authorizationUrl with user provided query parameters #1712

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

Merged
merged 1 commit into from
Mar 4, 2024

Conversation

pietrygamat
Copy link
Contributor

@pietrygamat pietrygamat commented Mar 2, 2024

Description

In some cases the authroization url may already contain some query parameters expected by the specific application, in which case oauth2 authorization request specific parameters should be appended to the list. Previous implementation assumed no query component in the authorization URI.

Fixes #1683

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.

Comment on lines 28 to 31
const authorizationUrlWithQueryParams =
`${authorizationUrl}` +
(authorizationUrl.indexOf('?') > -1 ? '&' : '?') +
`client_id=${clientId}&redirect_uri=${callbackUrl}&response_type=code&scope=${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.

Feedback on the most idiomatic syntax for this apprieciated.

@helloanoop
Copy link
Contributor

@pietrygamat The syntax looks good. Can you resolve the conflicts?

@helloanoop helloanoop merged commit 5f35d71 into usebruno:main Mar 4, 2024
@helloanoop
Copy link
Contributor

Thanks for taking care of this @pietrygamat !

cc @lohxt1

@pietrygamat pietrygamat deleted the bugfix/1683 branch March 4, 2024 17:07
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.

Oauth2: auth url with required pre-exisiting parameters
2 participants