diff --git a/packages/bruno-electron/src/ipc/network/oauth2-helper.js b/packages/bruno-electron/src/ipc/network/oauth2-helper.js index 1367523a0..2134b7d1f 100644 --- a/packages/bruno-electron/src/ipc/network/oauth2-helper.js +++ b/packages/bruno-electron/src/ipc/network/oauth2-helper.js @@ -47,10 +47,13 @@ const getOAuth2AuthorizationCode = (request, codeChallenge) => { const { oauth2 } = request; const { callbackUrl, clientId, authorizationUrl, scope, pkce } = oauth2; - let authorizationUrlWithQueryParams = `${authorizationUrl}?client_id=${clientId}&redirect_uri=${callbackUrl}&response_type=code&scope=${scope}`; + let oauth2QueryParams = + (authorizationUrl.indexOf('?') > -1 ? '&' : '?') + + `client_id=${clientId}&redirect_uri=${callbackUrl}&response_type=code&scope=${scope}`; if (pkce) { - authorizationUrlWithQueryParams += `&code_challenge=${codeChallenge}&code_challenge_method=S256`; + oauth2QueryParams += `&code_challenge=${codeChallenge}&code_challenge_method=S256`; } + const authorizationUrlWithQueryParams = authorizationUrl + oauth2QueryParams; try { const { authorizationCode } = await authorizeUserInWindow({ authorizeUrl: authorizationUrlWithQueryParams,