Skip to content

Commit 43ebf7a

Browse files
committed
Fix #1683 allow OAuth2 authorizationUrl with user provided query parameters
1 parent 9d3df0a commit 43ebf7a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/bruno-electron/src/ipc/network/oauth2-authorization-code-helper.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ const getOAuth2AuthorizationCode = (request) => {
2525
return new Promise(async (resolve, reject) => {
2626
const { oauth2 } = request;
2727
const { callbackUrl, clientId, authorizationUrl, scope } = oauth2;
28-
const authorizationUrlWithQueryParams = `${authorizationUrl}?client_id=${clientId}&redirect_uri=${callbackUrl}&response_type=code&scope=${scope}`;
28+
const authorizationUrlWithQueryParams =
29+
`${authorizationUrl}` +
30+
(authorizationUrl.indexOf('?') > -1 ? '&' : '?') +
31+
`client_id=${clientId}&redirect_uri=${callbackUrl}&response_type=code&scope=${scope}`;
2932
try {
3033
const code = await authorizeUserInWindow({ authorizeUrl: authorizationUrlWithQueryParams, callbackUrl });
3134
resolve(code);

0 commit comments

Comments
 (0)