Skip to content

Commit

Permalink
Fix usebruno#1683 allow OAuth2 authorizationUrl with user provided pa…
Browse files Browse the repository at this point in the history
…rameters
  • Loading branch information
pietrygamat committed Mar 2, 2024
1 parent 9d3df0a commit 00b9dd5
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ const getOAuth2AuthorizationCode = (request) => {
return new Promise(async (resolve, reject) => {
const { oauth2 } = request;
const { callbackUrl, clientId, authorizationUrl, scope } = oauth2;
const authorizationUrlWithQueryParams = `${authorizationUrl}?client_id=${clientId}&redirect_uri=${callbackUrl}&response_type=code&scope=${scope}`;
const authorizationUrlWithQueryParams =
`${authorizationUrl}` +
(authorizationUrl.indexOf('?') > -1 ? '&' : '?') +
`client_id=${clientId}&redirect_uri=${callbackUrl}&response_type=code&scope=${scope}`;
try {
const code = await authorizeUserInWindow({ authorizeUrl: authorizationUrlWithQueryParams, callbackUrl });
resolve(code);
Expand Down

0 comments on commit 00b9dd5

Please sign in to comment.