Fix: OAuth2 Authorization Request OPTIONAL parameters are required by bruno (#1797) (#1807)

This commit is contained in:
Mateusz Pietryga 2024-03-22 14:14:19 +01:00 committed by GitHub
parent 753ca4341f
commit 0f69c30a86
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -49,8 +49,13 @@ const getOAuth2AuthorizationCode = (request, codeChallenge, collectionUid) => {
const { callbackUrl, clientId, authorizationUrl, scope, pkce } = oauth2; const { callbackUrl, clientId, authorizationUrl, scope, pkce } = oauth2;
let oauth2QueryParams = let oauth2QueryParams =
(authorizationUrl.indexOf('?') > -1 ? '&' : '?') + (authorizationUrl.indexOf('?') > -1 ? '&' : '?') + `client_id=${clientId}&response_type=code`;
`client_id=${clientId}&redirect_uri=${callbackUrl}&response_type=code&scope=${scope}`; if (callbackUrl) {
oauth2QueryParams += `&redirect_uri=${callbackUrl}`;
}
if (scope) {
oauth2QueryParams += `&scope=${scope}`;
}
if (pkce) { if (pkce) {
oauth2QueryParams += `&code_challenge=${codeChallenge}&code_challenge_method=S256`; oauth2QueryParams += `&code_challenge=${codeChallenge}&code_challenge_method=S256`;
} }