diff --git a/packages/bruno-electron/src/ipc/network/oauth2-helper.js b/packages/bruno-electron/src/ipc/network/oauth2-helper.js index c5a8a6a21..889059821 100644 --- a/packages/bruno-electron/src/ipc/network/oauth2-helper.js +++ b/packages/bruno-electron/src/ipc/network/oauth2-helper.js @@ -49,8 +49,13 @@ const getOAuth2AuthorizationCode = (request, codeChallenge, collectionUid) => { const { callbackUrl, clientId, authorizationUrl, scope, pkce } = oauth2; let oauth2QueryParams = - (authorizationUrl.indexOf('?') > -1 ? '&' : '?') + - `client_id=${clientId}&redirect_uri=${callbackUrl}&response_type=code&scope=${scope}`; + (authorizationUrl.indexOf('?') > -1 ? '&' : '?') + `client_id=${clientId}&response_type=code`; + if (callbackUrl) { + oauth2QueryParams += `&redirect_uri=${callbackUrl}`; + } + if (scope) { + oauth2QueryParams += `&scope=${scope}`; + } if (pkce) { oauth2QueryParams += `&code_challenge=${codeChallenge}&code_challenge_method=S256`; }